- From: Philip Jägenstedt <notifications@github.com>
- Date: Thu, 02 Oct 2025 03:31:01 -0700
- To: whatwg/fetch <fetch@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Thursday, 2 October 2025 10:31:05 UTC
foolip created an issue (whatwg/fetch#1861)
### What problem are you trying to solve?
`response.body` is a stream of `Uint8Array` but often you want to deal with text. `response.text()` decodes the response body as text and returns it, but all at once, not streaming.
### What solutions exist today?
```js
let response = await fetch('/');
let decoder = new TextDecoderStream();
response.body.pipeThrough(decoder);
```
### How would you solve it?
A `textStream()` helper that gives you a stream of decoded text chunks instead.
### Anything else?
This is mainly motivated by https://github.com/whatwg/html/issues/11669, where a `ReadableStream` will needed. If it's as easy to get a string stream as a byte stream, then we could probably make those APIs only accept strings. (My current thinking was to bake text decoding into them to reduce boilerplate, but @noamr suggested a new method instead.)
--
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/issues/1861
You are receiving this because you are subscribed to this thread.
Message ID: <whatwg/fetch/issues/1861@github.com>
Received on Thursday, 2 October 2025 10:31:05 UTC