Skip to content

doc: backpressuring in streams guide #1668

Closed
@Bamieh

Description

@Bamieh

In the backpressuring-in-streams guide, this line of text should be updated:

pump is a utility tool that would properly destroy all the streams in a pipeline if one of them fails or closes, and is a must have in this case!

As of node 10, pipeline is introduced to solve this issue, so there is no need to reference an external utility any more 🎉 . I believe the guide should reflect on this new feature providing a small code snippet along with a link to the docs.

const pipeline = util.promisify(stream.pipeline);

async function run() {
  await pipeline(
    fs.createReadStream('archive.tar'),
    zlib.createGzip(),
    fs.createWriteStream('archive.tar.gz')
  );
  console.log('Pipeline succeeded');
}

I am willing to submit a PR if I am on the right track.

Cheers!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions