node-rafting
A way to group multiple writable streams together to pipe or write to simultaneously
example
var rafting = require('rafting')
, fs = require('fs')
;
var stream = rafting.createWriteStream(outstreamA, outstreamB)
instream.pipe(stream)
instream will be piped to outstreamA and outstreamB. For a more detailed example checkout the example directory.
API
createWriteStream([stream], [stream], ...)
Creates a CompositeStream object wrapping all the writable streams passed to it.
push(stream)
Pushes an additional stream to the CompositeStream object.
stream.write(string, [encoding], [fd]) / stream.write(buffer)
Calls each contained stream own write method. Returns false if any one of the streams could not flush the buffer to the kernel.
stream.end() / stream.end(string, encoding) / stream.end(buffer)
Calls the end method for each of the contained stream. Turns the stream writable flag off.
Event: 'drain'
function () {}
After a write returned false, emitted once only after all contained streams had emitted the drain event.
Event: 'error'
function (exception, [stream]) {}
Emitted on error with exception. If the error was emitted by a contained stream, stream argument will be that stream, otherwise it will be null.
install
npm install rafting
license
MIT