What is the difference between util.pump(streamA, streamB) and streamA.pipe(streamB)?

Stream.pipe is now the preferred method apparently since 0.3.x so try and use that when possible

sources:

https://groups.google.com/forum/?fromgroups#!topic/nodejs/FwdDQvAf4xM

https://stackoverflow.com/a/4591335/424851


There are two significant difference between the two. The first is that the util.pump method can operate on two "stream-like" objects, while the Stream.prototype.pipe assumes that they are stream objects. The second is because of that assumption, the pipe can be chained ( streamA | streamB | streamC ) while the former can't (easily).

Tags:

Stream

Node.Js