Node.js FAQ: Top Questions
11. What are streams in Node.js?
Streams in Node.js are objects that handle data in a continuous flow, allowing efficient processing of large or chunked data without loading it entirely into memory.
Key points:
- Types: Readable, Writable, Duplex, Transform.
- Benefits: Memory-efficient, supports backpressure for flow control.
-
Methods:
pipe,read,write,end. -
Core Modules:
fs,http,zlibuse streams. - Use Case: File processing, network requests, data compression.
