TextDecoderStream
A stream transformer that turns incoming bytes into text using a character encoding such as UTF-8, even when a character is split across chunks.
In more detail
It defaults to UTF-8. Pipe a response through it with response.body.pipeThrough(new TextDecoderStream()) to read text chunks directly.
Related terms
- ReadableStream — A browser object that delivers data in chunks as it arrives, such as a fetch response.body, instead of all at once at the end.
- character encoding — The rule for turning text characters into bytes and back, such as UTF-8.
Taught in
- The Fetch API: Streaming Responses, HTTP Caching And Keepalive — Frontend Architecture & Web Platform