- From: Kevin Gibbons <notifications@github.com>
- Date: Fri, 27 Oct 2023 11:57:16 -0700
- To: whatwg/streams <streams@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Friday, 27 October 2023 18:57:22 UTC
> just figured if this could be part of something like [iterator helpers](https://github.com/alkihis/iterator-helper) As mentioned above, iterator helpers have a `.toArray` method, and async iterator helpers will have the same. The helper will let you do `await stream.values().toArray()`, which is nicer than what you currently do - but getting all the bytes into a single buffer after is still going to be awkward, and even with a helper like [this](https://github.com/jasnell/proposal-zero-copy-arraybuffer-list) you'd still have a choice between either copying every chunk after reading all of them or giving up locality. This use case really wants a more specific "put all the bytes from a readable byte stream into a single buffer" helper. And iterator helpers are intended as fully general utilities, so they're probably not the right place to have a method specifically for producers which yield chunks of bytes. That's a pretty uncommon thing to do with iterators anyway; the ReadableStream machinery is much better suited to handle such producers efficiently. -- Reply to this email directly or view it on GitHub: https://github.com/whatwg/streams/issues/1019#issuecomment-1783370295 You are receiving this because you are subscribed to this thread. Message ID: <whatwg/streams/issues/1019/1783370295@github.com>
Received on Friday, 27 October 2023 18:57:22 UTC