package
Like duplexer but using streams3
npm install duplexer2GitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
Estimated unpacked size across 11 packages.
900.8 kB
Includes dependencies.
Like duplexer but using Streams3
var stream = require("stream");
var duplexer2 = require("duplexer2");
var writable = new stream.Writable({objectMode: true}),
readable = new stream.Readable({objectMode: true});
writable._write = function _write(input, encoding, done) {
if (readable.push(input)) {
return done();
} else {
readable.once("drain", done);
}
};
readable.
got data "oh, hi there"
finished writing
got finish event
finished ending
got end eventThis is a reimplementation of duplexer using the Streams3 API which is standard in Node as of v4. Everything largely works the same.
$ npm i duplexer2Creates a new DuplexWrapper object, which is the actual class that implements
most of the fun stuff. All that fun stuff is hidden. DON'T LOOK.
duplexer2([options], writable, readable)const duplex = duplexer2(new stream.Writable(), new stream.Readable());Arguments
stream.Duplex options, as
well as the properties described below.Options
true.3-clause BSD. A copy is included with the source.
shinnn
snnskwtnb@gmail.com