TextDecoderStream.encoding

The encoding read-only property of the TextDecoderStream interface returns a DOMString containing the name of the encoding algorithm used by the specific encoder.

Value

A DOMString, ASCII lowercased.

Examples

Returning the value of encoding from a TextDecoderStream.

stream = new TextDecoderStream();
console.log(stream.encoding); // returns the default "utf-8"

Specifications

Specification
Encoding
# dom-textdecoder-encoding

Browser compatibility

BCD tables only load in the browser