Re: [whatwg/streams] ReadableStream.prototype.arrayBuffer() (#1019)

> Maybe I'm missing something but I don't see this part in this thread, has there been discussion about this somewhere else? new Response(stream).arrayBuffer() throws if the chunk is not Uint8Array, so this is a bit surprising to me.

This was based on @jimmywarting 
 and @jakearchibald's comments: https://github.com/whatwg/streams/issues/1019#issuecomment-587358358

However, on re-reading I realised that @jakearchibald was only saying this should work for the `blob()` method. This comes for free if you create a Blob by converting the ReadableStream to an array and then calling the `Blob(array)` constructor, but I would like to stream data into the Blob if at all possible.

Anyway, it looks like we don't have consensus on this item, so let's discuss it a bit more.

First question: should all of `text()`, `blob()` and `bytes()` accept the same chunk types?

Arguments for:
* Easy to explain.
* Avoids people doing hacks like `await (await response.body.blob()).text()` just to accept the largest possible set of chunk types.

Arguments against:
* Implicit conversions between text and binary are nasty.
* Blob chunks are annoying to implement because the contents may only be available asynchronously.

Anything else?

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/streams/issues/1019#issuecomment-2042600008
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/streams/issues/1019/2042600008@github.com>

Received on Monday, 8 April 2024 12:19:22 UTC