1.0.0 • Published 6 years ago

stream-toduplex v1.0.0

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

stream-toduplex

Make one writable stream and one readable stream into a single duplex stream.

Install

npm install --save stream-toduplex

Usage

const toDuplex = require("stream-toduplex");

// Assume that there are some TransformStreams.
const first = someTransformStream();
const middle = someTransformStream();
const last = someTransformStream();

// Make the above transforming processes into one duplex stream
const duplex = toDuplex(first, last);
first.pipe(middle).pipe(last);

You can also use toDuplex.connect in the above situation.

const duplex = toDuplex.connect([first, middle, last]);
// first.pipe(middle).pipe(last);  // not needed