Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Is there a NodeJS 'passthrough' stream?

Is there a NodeJS 'passthrough' stream?


Is there a NodeJS 'passthrough' stream?

i.e. an object where whatever I put in to it comes out immediately, unchanged.

It seems pointless, but it would be useful as a 'static centre' for rapidly changing code during development.

Problem courtesy of: chrisdew


Yeah. Actually, by that very name. :)


It's available with Node 0.10 and later as part of the Streams 2 update (mentioned at the end).

It's also one of the few types from Streams that can be directly instantiated:

var pass = new stream.PassThrough();

And, it's currently documented briefly under API for Stream Implementors (towards the bottom of the Steams ToC).

Solution courtesy of: Jonathan Lonowski


View additional discussion.

This post first appeared on Node.js Recipes, please read the originial post: here

Share the post

Is there a NodeJS 'passthrough' stream?


Subscribe to Node.js Recipes

Get updates delivered right to your inbox!

Thank you for your subscription