Q18: What are Streams in Node.js and why are they used?

Streams are data-handling channels used to read or write data sequentially. They conserve memory by processing data in chunks rather than reading entire files into memory at once.

Key Takeaways
  • Streams process large datasets in small chunks to reduce memory consumption.
  • Four core types exist: Readable, Writable, Duplex, and Transform.
Knowledge Check

Which stream type allows modifying data as it is being read and written?