Skip to content

stream: compose#39029

Closed
ronag wants to merge 8 commits intonodejs:masterfrom
nxtedition:stream-pipe
Closed

stream: compose#39029
ronag wants to merge 8 commits intonodejs:masterfrom
nxtedition:stream-pipe

Conversation

@ronag
Copy link
Member

@ronag ronag commented Jun 14, 2021

pipe is similar to pipeline however it supports stream composition, i.e.

const transform3 = stream.pipe(transform1, transform2)
// transform3 is a writable

stream.pipeline(source, transform3, sink, (err) => console.log('err'))

Similar to how rx js provides a top level pipe(...observables) method.

@ronag
Copy link
Member Author

ronag commented Jun 14, 2021

@nodejs/streams Looking for some initial feedback before starting work on tests.

@github-actions github-actions bot added the needs-ci PRs that need a full CI run. label Jun 14, 2021
@ronag ronag added the stream Issues and PRs related to the stream subsystem. label Jun 14, 2021
@ronag ronag force-pushed the stream-pipe branch 19 times, most recently from 2e23587 to 46ddf18 Compare June 14, 2021 14:59
@targos
Copy link
Member

targos commented Jun 14, 2021

@nodejs/streams

@vweevers
Copy link
Contributor

@ronag Knowing that stream.pipeline() is the equivalent of pump, can we say that stream.pipe() is the equivalent of pumpify?

@mscdex
Copy link
Contributor

mscdex commented Jun 14, 2021

I'm not familiar with the use cases for this, but I think it can be a bit confusing because of the function name (and where it's being exported) and because we already have the pre-existing pipe() and pipeline(). Does this really need to exist in node core?

@vweevers
Copy link
Contributor

I'm not familiar with the use cases for this

#32020

@ronag
Copy link
Member Author

ronag commented Jun 14, 2021

Does this really need to exist in node core?

There is #32020 and also pumpify which is not entirely correct.

@vweevers
Copy link
Contributor

I think it can be a bit confusing because of the function name [and] the pre-existing pipe()

Some options:

  1. No bikeshedding, risking some confusion. Call it pipe() because it's a fitting term. The way I see it, multiple open-ended "pipes" can be combined to form a closed-ended "pipeline". When context requires it, use additional words to differentiate between stream.pipe and stream.prototype.pipe. Same as events.once versus events.prototype.once.
  2. Make up a new distinct term, which could take more effort to explain. Ex: segment(), compose().
  3. Make it descriptive at the cost of verbosity. Ex: duplexPipeline(), duplexFrom(), writablePipeline().

@ronag
Copy link
Member Author

ronag commented Jun 14, 2021

Rxjs does 1. So there is some precedence.

@MattiasBuelens
Copy link
Contributor

@ronag Sure! 🙂 If it matters for scheduling purposes: I'm based in Europe (currently CEST).

@ronag
Copy link
Member Author

ronag commented Jul 8, 2021

I'm CEST as well. I can be quite flexible next week. What about @benjamingr?

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@nodejs-github-bot
Copy link
Collaborator

@ronag
Copy link
Member Author

ronag commented Jul 12, 2021

This has sufficient approvals but I think @benjamingr would like to further discuss this before landing? @benjamingr would you mind doing a "request for changes" so we don't accidentally land this before that?

@nodejs-github-bot
Copy link
Collaborator

@ronag
Copy link
Member Author

ronag commented Jul 12, 2021

@nodejs/streams @mcollina I've disabled async function support. I believe in this way this can land without any pending items. I'll open a separate PR we can discuss in regards to async fn/gen API.

This way we can continue with e.g. web stream support

Please 👍 so I know whether I can land this.

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

ronag and others added 2 commits July 13, 2021 10:06
Co-authored-by: Michaël Zasso <targos@protonmail.com>
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@ronag
Copy link
Member Author

ronag commented Jul 19, 2021

Landed in e579acb

@targos
Copy link
Member

targos commented Jul 21, 2021

Like #39134 (comment), this needs a backport to land on v16.x because it depends on the semver-major #39294

@ronag
Copy link
Member Author

ronag commented Jul 28, 2021

#39563

@targos targos mentioned this pull request Sep 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

notable-change PRs with changes that should be highlighted in changelogs. semver-minor PRs that contain new features and should be released in the next minor version. stream Issues and PRs related to the stream subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants