Is there a NodeJS 'passthrough' stream?
Problem
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
Solution
Yeah. Actually, by that very name. :)
stream.PassThrough
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
Discussion
View additional discussion.