TextDecoderStream() constructor creates a new
TextDecoderStream object which is used to convert a stream of text in a binary encoding into strings.
new TextDecoderStream(label) new TextDecoderStream(label, options)
The following example demonstrates how to decode binary data retrieved from a
fetch() call. The data will be interpreted as UTF-8, as no
label has been passed.
const response = await fetch("https://example.com"); const stream = response.body.pipeThrough(new TextDecoderStream());
BCD tables only load in the browser