-
Notifications
You must be signed in to change notification settings - Fork 29.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
stream: add pipeline() for webstreams #46307
stream: add pipeline() for webstreams #46307
Conversation
Review requested:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer if we could avoid transforming into node stream
Any suggestion what alternative you would prefer? |
What I wrote 😄. We don't convert generators to streams. Instead we have a custom function pumping. |
Ah ok yes 😅😅, I think could try using pipeThrough of readable streams, converting the PR to draft |
Ok this requires some work closing this for now will reopen with fresh version 😅😅 |
Hi @ronag we are in an interesting position in regards to this PR turns out pipeline already supports webstreams due to #46307 since the pipeline is converting streams to duplexes and duplex now supports webstreams, except it breaks if transform streams are added in between, so I am thinking could do two things
would this be an acceptable path? |
Hello, have updated the code, 3 tests are failing which shall fix in a while but generally have updated to not convert everything to nodestreams 😅😅, could you please take a look again @ronag if the general direction seems to be correct? |
Just took a very quick look but it seems to be right general direction. |
Reopening for review all the tests passing! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would make two separate pump functions.
Ok refactoring |
The code would be duplicated no? |
Have updated to use a separate function |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
}); | ||
const ws = new WritableStream({ | ||
write(chunk) { | ||
values.push(chunk?.toString()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: since the test is only pushing strings through, perhaps just simply values.push(chunk)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure updating
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
Landed in 23effb2 |
This one had taken quite some trial and error! |
Refs: #39316 PR-URL: #46307 Reviewed-By: Robert Nagy <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]>
Refs: nodejs#39316 PR-URL: nodejs#46307 Reviewed-By: Robert Nagy <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]>
Refs: nodejs#39316 PR-URL: nodejs#46307 Reviewed-By: Robert Nagy <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]>
Refs: #39316 PR-URL: #46307 Reviewed-By: Robert Nagy <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]>
Added support to using pipeline() for webstreams and added tests for both webstreams and mixture of node streams and webstreams with pipeline
Refs: #39316