Text encoding and decoding will support streams to enable you to easily convert streams of binary data to text and vice-versa. An example of its usefulness is with readable streams. With a non-stream Response object, response.Body.text() returns text. There is no equivalent for the ReadableStream returned by Response.Body, which can only return bytes. With the new API a streaming response body may be converted to text as so: Response.Body.pipeThrough(new TextDecoderStream()).
Specification currently under development in a Working Group
Status in Chromium
Enabled by default
Consensus & Standardization
Search tagsTextEncoder, TextDecoder, TransformStream, ReadableStream, WritableStream, transform streams,
Last updated on 2020-11-09