Types of stream

If we want to make a stream that provides data for other users to read, we need to make a readable stream. An example of a readable stream could be a stream that reads data from a file stored on disk.

If we want to make a stream that other users can write data to, we need to make a writable stream. An example of a writable stream could be a stream that writes data to a file stored on disk.

Inspecting all core stream interfaces
Node core provides base implementations of all these variations of streams that we can extend to support various use cases. We can use node -p require('stream') as a convenient way to take look at available stream implementations.

Sometimes you want to make a stream that is both readable and writable at the same time. We call these duplex streams. An example of a duplex stream could be a TCP network stream that both allows us to read data from the network and write data back at the same time.

A special case of a duplex stream is a stream that transforms the data being written to it and makes the transformed data available to read out of the stream. We call these transform streams. An example of a transform stream could be a GZIP stream that compresses the input data written to it.