July 2017
Intermediate to advanced
656 pages
16h 1m
English
If we wanted our own readable stream, we would need the stream.Readable base constructor.
This base class will call a special method called _read. It's up to us to implement the _read method. Since Node 4, we can also supply a read property to an options object, which will be the supplied function to be added as the _read method of the returned instance.
Whenever this method is called, the stream expects us to provide more data available that can be consumed by the stream. We can add data to the stream by calling the push method with a new chunk of data.