Version
26.1.0
Platform
Subsystem
stream
What steps will reproduce the bug?
import { pipeTo, push, text } from "node:stream/iter";
const enc = new TextEncoder();
async function repro(source) {
const { writer, readable } = push({
highWaterMark: 1,
backpressure: "block",
});
const piping = pipeTo(source(), writer);
// Let pipeTo() fill the PushWriter queue before the reader drains it.
await new Promise(setImmediate);
const output = await text(readable);
await piping;
return output;
}
async function* writevSource() {
yield [enc.encode("ab")];
yield [enc.encode("c"), enc.encode("d")];
}
async function* writeSource() {
yield [enc.encode("a")];
yield [enc.encode("b")];
}
console.log(await repro(writevSource)); // actual: abcdcd, expected: abcd
console.log(await repro(writeSource)); // actual: abbb, expected: ab
Run with
node --experimental-stream-iter repro.js
How often does it reproduce? Is there a required condition?
Always
What is the expected behavior? Why is that the expected behavior?
What do you see instead?
Additional information
No response
Version
26.1.0
Platform
Subsystem
stream
What steps will reproduce the bug?
Run with
node --experimental-stream-iter repro.jsHow often does it reproduce? Is there a required condition?
Always
What is the expected behavior? Why is that the expected behavior?
What do you see instead?
Additional information
No response