-
-
Notifications
You must be signed in to change notification settings - Fork 32.9k
Closed
Labels
Description
Version
v16.6.2
Platform
Linux solus 5.13.8-191.current #1 SMP PREEMPT Fri Aug 6 11:29:58 UTC 2021 x86_64 GNU/Linux
Subsystem
stream/web
What steps will reproduce the bug?
import {ReadableStream} from 'stream/web';
let controller;
let start = c => (controller = c);
let pull = () => {
if (pull.called) return;
pull.called = true;
process.nextTick(() => {
controller.enqueue(new Uint8Array([102, 111, 111, 98, 97, 114]))
process.nextTick(() => {
controller.close()
});
});
};
const [a, b] = new ReadableStream({start, pull}).tee();
for (const stream of [a, b]) {
const chunks = [];
for await (const chunk of stream) {
chunks.push(chunk);
}
console.log('received:', Buffer.concat(chunks).toString());
}
How often does it reproduce? Is there a required condition?
Always.
What is the expected behavior?
received: foobar
received: foobar
What do you see instead?
received: foobar
received:
Additional information
Deno for reference: https://github.com/denoland/deno/blob/a0285e2eb88f6254f6494b0ecd1878db3a3b2a58/ext/web/06_streams.js#L1465-L1543