1.0.0 • Published 9 years ago
stream-n-way v1.0.0
stream-n-way
N-way splitter for streams.
Install
$ npm install stream-n-wayUsage
new StreamNWay(n,options)
- Options
<Object>- streamAtIndex
<Function>A callback function with an index andoptionsto be invoked for a custom stream. - Any
stream.Readableoptions
- streamAtIndex
let stream = require("stream");
let StreamNWay = require("stream-n-way");
let w = new stream.Writable({
objectMode: true,
write(chunk, enc, cb) {
console.log(chunk);
cb();
}
});
// Split a stream to 2 new streams.
let s = new StreamNWay(2, { objectMode: true });
s.children.forEach((c) => c.pipe(w));
// Pushing to `s` will pipe to the two splitter streams.
s.push("Stream me up");
s.push(null);1.0.0
9 years ago