1.

What is node.js streams?

Answer»

Streams are instances of EventEmitter which can be used to work with STREAMING data in Node.js. They can be used for handling and manipulating streaming large FILES(videos, mp3, etc) over the network. They use buffers as their temporary storage.

There are mainly FOUR types of the STREAM:

  • Writable: streams to which data can be written (for example, fs.createWriteStream()).
  • Readable: streams from which data can be read (for example, fs.createReadStream()).
  • DUPLEX: streams that are both Readable and Writable (for example, net.Socket).
  • Transform: Duplex streams that can modify or transform the data as it is written and read (for example, zlib.createDeflate()).


Discussion

No Comment Found