Skip to content

Instantly share code, notes, and snippets.

@dhritzkiv
Last active October 2, 2015 05:55
Show Gist options
  • Save dhritzkiv/210976f47e8e9722a5a9 to your computer and use it in GitHub Desktop.
Save dhritzkiv/210976f47e8e9722a5a9 to your computer and use it in GitHub Desktop.
Chaining an arbitrary number of node.js Streams
//readStream is a readable input stream;
//writeStream is a writable output stream; and
//transformStreamsArray is a predefined array with an arbitrary number of transform streams;
transformStreamsArray
.reduce((previousStream, thisStream) => previousStream.pipe(thisStream), readStream)
.pipe(writeStream);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment