Skip to main content

Posts

Showing posts with the label web
  Stream in NodeJS In Node.js, streams are a powerful way to handle data in a continuous, chunk-by-chunk manner. Instead of loading an entire file or data source into memory, streams process data as it becomes available, making them highly efficient for large files, network requests, and other I/O operations. There are four main types of streams: Readable:  A stream from which you can read data. Examples include  fs.createReadStream()  for files and the  http.IncomingMessage  object on a server. Writable:  A stream to which you can write data. Examples include  fs.createWriteStream()  for files and the  http.ServerResponse  object for a server's response. Duplex:  A stream that is both Readable and Writable. An example is a  net.Socket . Transform:  A Duplex stream that can modify or transform data as it is written and read. A good example is the  zlib  module for compression and decompression. How to Use St...