InterviewBuddy
All interview questions

What does backpressure mean in Node.js streams?

Advanced

Answer

Backpressure slows a producer when the consumer cannot keep up. When a writable stream returns false from write(), wait for drain before writing more.

Explanation

Ignoring the signal can cause excessive buffering and memory use.

Example

write(chunk) returns false → pause → drain → resume