June 2014
Intermediate to advanced
696 pages
38h 52m
English
One of the coolest things you can do with stream objects is chain Readable streams to Writable streams by using the pipe(writableStream, [options]) function. This does exactly what the name implies: It inputs the output from the Readable stream directly into the Writable stream. The options parameter accepts an object with the end property set to true or false. When end is true, the Writable stream ends when the Readable stream ends. This is the default behavior. For example:
readStream.pipe(writeStream, {end:true});
You can also break the pipe programmatically by using the unpipe(destinationStream) option. The code in Listing 5.10 implements a Readable stream and a Writable ...
Read now
Unlock full access