July 2017
Intermediate to advanced
656 pages
16h 1m
English
The I/O channels (STDOUT, STDERR, STDIN) are implemented using Node.js streams.
We'll find out more about Node.js streams in Chapter 4, Using Streams. We also have an example in the There's more... section of this recipe, regarding using the standard I/O channels as streams.
Suffice it to say, that Node Stream instances (instantiated from Node's core stream module) inherit from EventEmitter (from Node's core events module), and emit a data event for every chunk of data received.
When in interactive mode (that is, when inputting via the keyboard), each data chunk is determined by a newline. When piping data through to the process, each data chunk is determined by the maximum memory consumption allowable for the stream (this ...