InterviewHubPRO
Section Overview
Q21

Question 21 of 60

Part 3: Streams, Buffers & Core Modules (21 - 35)

35%
Node.js & Libuv•Part 3: Streams, Buffers & Core Modules (21 - 35)

What are Node.js Streams and why are they essential?

In Simple Words: Streams process data sequentially chunk by chunk instead of reading the entire payload into RAM at once. Enables handling multi-gigabyte files or network payloads with constant, minimal memory consumption.

javascript
const fs = require('fs');

// Streaming 5GB file with constant ~30MB memory consumption:
const readStream = fs.createReadStream('large_video.mp4');
const writeStream = fs.createWriteStream('copy.mp4');
readStream.pipe(writeStream);