socket.io-pull-stream
Pull Streams for socket.io
API
-
sp(io[, opt])
Will add the functions below to
io
-
io
: Socket.io-client instance -
opt
: Default options for every stream
-
-
.createSink([id, opt])
Will create a sink with
id
. If no id is provided a new id will be generated and can be found undersink.id
-
opt
: Object. Config for stream-
codec
: Codec to use.Either string (
hex, plain, buffer
) or object ({encode: data => ..., decode: data => ...}
).Default:
plain
-
Returns: Sink Function
-
-
.createSource(id[, opt])
Will create a source that reads from a sink with id
id
on the other side.-
opt
: Object. Config for stream-
codec
: Codec to use.Either string (
hex, plain, buffer
) or object ({encode: data => ..., decode: data => ...}
).Default:
plain
-
Returns: Source Function
-
-
.createProxy(id, to)
Will proxy the stream
id
to socketto
Examples
File Stream
Server:
const sp = const fs = const toPull = const pull = io
Client:
const sp = const pull = io
To send streams between clients the stream need to be proxied
// TODO :add