Version
26.2.0
Platform
Subsystem
stream
What steps will reproduce the bug?
import { pipeTo, from } from 'node:stream/iter';
const chunks = [];
const writer = {
transform() {
console.log('BUG: writer.transform() was called');
return null;
},
write(chunk) {
chunks.push(new TextDecoder().decode(chunk));
},
};
await pipeTo(from('hello'), writer);
console.log(chunks.join(''));
How often does it reproduce? Is there a required condition?
Always
What is the expected behavior? Why is that the expected behavior?
The final pipeTo() argument should be treated only as the destination writer; transform objects are only the arguments before the writer.
What do you see instead?
BUG: writer.transform() was called
node:internal/streams/iter/pull:584
for await (const item of output) {
^
TypeError: Cannot read properties of null (reading 'Symbol(Symbol.asyncIterator)')
at applyStatefulAsyncTransform (node:internal/streams/iter/pull:584:28)
at applyStatefulAsyncTransform.next (<anonymous>)
at createAsyncPipeline (node:internal/streams/iter/pull:703:22)
at createAsyncPipeline.next (<anonymous>)
at pipeTo (node:internal/streams/iter/pull:1000:26)
at file:///Users/trivikram/workspace/test-repro/repro.js:15:7
at ModuleJob.run (node:internal/modules/esm/module_job:439:25)
at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
at async node:internal/modules/esm/loader:646:26
at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:101:5)
pipeTo() calls writer.transform() when the destination writer object also has a transform() method, so the writer is treated as a transform as well as the destination.
Additional information
No response
Version
26.2.0
Platform
Subsystem
stream
What steps will reproduce the bug?
How often does it reproduce? Is there a required condition?
Always
What is the expected behavior? Why is that the expected behavior?
helloThe final
pipeTo()argument should be treated only as the destination writer; transform objects are only the arguments before the writer.What do you see instead?
pipeTo()callswriter.transform()when the destination writer object also has atransform()method, so the writer is treated as a transform as well as the destination.Additional information
No response