The source code looks very similar: pump, pipe. Why would I use one instead of the other? Is one simply a better version of the other?
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).