Node.js Streams & Backpressure
Readable, Writable, and Transform streams, .pipe() vs stream.pipeline(), what backpressure actually protects, and how object mode changes the rules. Every answer is verified by running the code in Node.
Questions
- Not answered. A Transform stream is a specialized form of which base stream class?
- Not answered. What does
writable.write(chunk)returningfalsetell you? - Not answered. What does backpressure in Node streams actually protect?
- Not answered. Which statements about
.pipe()andstream.pipeline()are correct? - Not answered. When writing custom streams, which implementation rules are correct?
- Not answered. In object mode, what is a stream's default
highWaterMark? - Not answered. What does enabling
objectMode: truechange about a stream? - Not answered. You write to a slow
Writablein a tight loop and ignore everyfalsereturn. What happens? - Not answered. After
write()returnsfalse, which event signals it is safe to resume writing? - Not answered. What is a Transform stream's
_flush(callback)method for? - Not answered.
fs.createReadStream(bigFile).pipe(res)streams a huge file to a slow HTTP client. How is memory kept bounded?