write() says stop
A slow writable with a fill line of 2 chunks, and three quick writes.
const { Writable } = require('node:stream');const slow = new Writable({ objectMode: true, highWaterMark: 2, write(chunk, enc, done) { setTimeout(done, 10); },});console.log('write 1 →', slow.write('1'));console.log('write 2 →', slow.write('2'));console.log('write 3 →', slow.write('3'));1. Predict the output
Tap the lines in the order you think they print.
- 1…
- 2…
- 3…