-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
Closed
Labels
feature requestIssues that request new features to be added to Node.js.Issues that request new features to be added to Node.js.streamIssues and PRs related to the stream subsystem.Issues and PRs related to the stream subsystem.
Description
- Version: v13.6.0
- Platform: Linux 535297d0ce81 4.19.0-4-amd64 deps: update openssl to 1.0.1j #1 SMP Debian 4.19.28-2 (2019-03-15) x86_64 GNU/Linux
- Subsystem: stream
What steps will reproduce the bug?
const stream = require('stream');
// two different transforms (these work)
const transform_double = new stream.Transform({
transform(chunk, encoding, callback) {
this.push(chunk);
this.push(chunk);
callback();
}
});
const transform_uppercase = new stream.Transform({
transform(chunk, encoding, callback) {
this.push(chunk.toString().toUpperCase());
callback();
}
});
// compose the transforms
const parser = stream.pipeline(transform_double, transform_uppercase, ()=>0);
// run stdin through it
process.stdin.pipe(parser).pipe(process.stdout);
Then pipe some text to it eg: echo "foo" | node reproduce.js
How often does it reproduce? Is there a required condition?
always
What is the expected behavior?
The text sent in should go through both transformations, eg output "FOOFOO"
What do you see instead?
The text piped in is only sent to the last transformation, eg output "FOO"
Additional information
The docs here don't say what this function returns:
https://nodejs.org/api/stream.html#stream_stream_pipeline_streams_callback
I'm saying that it should return a duplex stream so I can read and write to the ends of the pipeline.
sindresorhus, timoxley, jbrobst and jpdenfordtimoxley and jpdenford
Metadata
Metadata
Assignees
Labels
feature requestIssues that request new features to be added to Node.js.Issues that request new features to be added to Node.js.streamIssues and PRs related to the stream subsystem.Issues and PRs related to the stream subsystem.