Reputation: 6964
code:
a.pipe(b).pipe(c).pipe(d);
Im node newbie. I read that for piping, the source should be a readable stream and destination should be a writeable stream.
Upvotes: 1
Views: 300
Reputation: 150902
Ad 1: Yes, a
must be a readable stream, and b
must be a writable one. But, streams are not neccessarily either / or, they also can be both: Readable and writeable at the same time. So, b
and c
are both, hence you can pipe into them, but also pipe from them. Technically they are so-called duplex streams.
Ad 2: Should be answered by now ;-).
Ad 3: Yes, you should definitely check out the stream-handbook by @substack (aka James Halliday). For buffers, see How to use buffers in Node.js by NodeJitsu.
Upvotes: 1