What are the streams in Node.js?

The Streams are the objects that facilitate you to read data from a source and write data to a destination. There are four types of streams in Node.js:

  • Readable: This stream is used for reading operations.
  • Writable: This stream is used for write operations.
  • Duplex: This stream can be used for both reading and write operations.
  • Transform: It is a type of duplex stream where the output computes according to input.