-
Notifications
You must be signed in to change notification settings - Fork 29.9k
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: utility consumers for web and node.js streams #39594
Conversation
Could a |
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. I think error and type checking is done indirectly.
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
344dba7
to
d0efbc0
Compare
This comment has been minimized.
This comment has been minimized.
What happens if the functions are called on object streams? |
This comment has been minimized.
This comment has been minimized.
For |
Signed-off-by: James M Snell <jasnell@gmail.com>
d0efbc0
to
ac912f5
Compare
Landed in c524107 |
Signed-off-by: James M Snell <jasnell@gmail.com> PR-URL: #39594 Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Signed-off-by: James M Snell <jasnell@gmail.com> PR-URL: #39594 Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
I wished that I'm a bit biased towards Buffer in general cuz it isn't cross env friendly. and it's bloated with stuff TextEncoder and DataView is suppose to solve for you when working with typed arrays |
Would it be optimizable if arrayBuffer() had a totalLength option too? There would not be pkg like this otherwise that don't need to take up twice the size when it's time to concatinate: |
Like #39134, this needs a volunteer to backport to v16.x-staging. |
I'm willing to take care of it. |
Signed-off-by: James M Snell <jasnell@gmail.com> PR-URL: nodejs#39594 Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Signed-off-by: James M Snell <jasnell@gmail.com> PR-URL: nodejs#39594 Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Isn't it already good? |
@Mesteery you're right, sorry. It looks like the backport-requested label was added by mistake |
@mcollina @ronag ... here's an alternative approach to the Body mixin stuff. Rather than providing the Body mixin directly, these introduce utility functions that can be used by the ecosystem to provide those basic methods, at least in part.
For a very rudimentary example...
These work with
ReadableStream
,stream.Readable
, and async interables.There's likely a bit more error handling that could be added but I wanted to at least open the PR to give a basic idea.