Encoding API
Mechanism for handling text in various character encodings, including legacy non-UTF-8 encodings.
The API provides four interfaces: TextDecoder, TextEncoder, TextDecoderStream and TextEncoderStream.
TextDecoderStream
Streaming equivalent of TextDecoder
.
const response = await fetch("https://example.com"); const stream = response.body.pipeThrough(new TextDecoderStream());