What are streams in Node and when do you use them?

Node.js modules, files and async · Freshers and experienced

Model answer

Streams process data in chunks instead of loading it all in memory: readable, writable, duplex and transform. Use them for large files, uploads, downloads and piping, for example fs.createReadStream(file).pipe(res). stream.pipeline handles errors and cleanup properly.

Learn this topic

Async JavaScript in Node: Promises, async/await and the Event Loop in the course Node.js and Express: Build a Back End API from Scratch.

Sign in to add your own answer.

More questions