Exploring streams
According to Bjarne Stoustrup in his book The C++ Programming Language, Third Edition:
Designing and implementing a general input/output facility for a programming language is notoriously difficult... An I/O facility should be easy, convenient, and safe to use; efficient and flexible; and, above all, complete.
It shouldn't surprise anyone that a design team, focused on providing efficient and easy I/O, has delivered such a facility through Node. Through a symmetrical and simple interface, which handles data buffers and stream events so that the implementer does not have to, Node's Stream
module is the preferred way to manage asynchronous data streams for both internal modules and, hopefully, for the modules developers will create.
A stream in Node is simply a sequence of bytes. At any time, a stream contains a buffer of bytes, and this buffer has a zero or greater length:
Because each character in a stream is well defined, and because every type of digital data...