Skip to content

Feature Request: way to merge streams like pumpify(a, b) #32020

@JasonWoof

Description

@JasonWoof

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestIssues that request new features to be added to Node.js.streamIssues and PRs related to the stream subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions