Back to the Catalog
nodejs
javascript
async

Node.js Streams & Backpressure

11 questions

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

  1. Not answered. A Transform stream is a specialized form of which base stream class?
  2. Not answered. What does writable.write(chunk) returning false tell you?
  3. Not answered. What does backpressure in Node streams actually protect?
  4. Not answered. Which statements about .pipe() and stream.pipeline() are correct?
  5. Not answered. When writing custom streams, which implementation rules are correct?
  6. Not answered. In object mode, what is a stream's default highWaterMark?
  7. Not answered. What does enabling objectMode: true change about a stream?
  8. Not answered. You write to a slow Writable in a tight loop and ignore every false return. What happens?
  9. Not answered. After write() returns false, which event signals it is safe to resume writing?
  10. Not answered. What is a Transform stream's _flush(callback) method for?
  11. Not answered. fs.createReadStream(bigFile).pipe(res) streams a huge file to a slow HTTP client. How is memory kept bounded?