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

I'm happy with this approach also (in contrast to what I suggest in #1238).

A key challenge I have with having these methods directly on `ReadableStream` is that they are not useful with `ReadableStreams` that are not byte-oriented. Putting these on a `Reader` instead makes it a bit nicer to limit to just byte-oriented streams similar to the how `ReadableStreamBYOBReader` does. If we do add these directly to `ReadableStream.prototype` then they should only work on byte-oriented streams.

`ReadableStream.prototype.array()` really isn't necessary given that `Array.fromAsync(...)` (https://github.com/tc39/proposal-array-from-async) is coming.

```js
const chunks = Array.fromAsync(readable);
```

`ReadableStream.prototype.text()` is a bit tricky if we can't specify the text encoding. With `response.text()` we can use the `content-type` to identify the encoding, and at that point there's a bit of overlap with `TextDecoderStream` that we'd need to reconcile. 


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

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

Received on Sunday, 24 March 2024 23:05:26 UTC