Skip to content
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

streams: add APIs from stream-consumers #3587

Closed
kt3k opened this issue Aug 30, 2023 · 2 comments · Fixed by #3631
Closed

streams: add APIs from stream-consumers #3587

kt3k opened this issue Aug 30, 2023 · 2 comments · Fixed by #3631

Comments

@kt3k
Copy link
Member

kt3k commented Aug 30, 2023

ref: https://github.com/jimmywarting/stream-consumers

These 4 APIs look very handy for handling readable streams. How about adding these to std/streams?

import { arrayBuffer, blob, json, text } from 'stream-consumers'
@0f-0b
Copy link
Contributor

0f-0b commented Sep 11, 2023

I don't think these functions provide much value. One can already write, for example, new Response(readable).json(), as noted in the readme. An async iterable or a Node.js Readable can first be converted with ReadableStream.from.

@kt3k
Copy link
Member Author

kt3k commented Sep 12, 2023

new Response(readable).json(), as noted in the readme.

That works, but as described in that readme, it feels still 'hack' and 'abuse' especially when you are not working on http server or client

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants