TextDecoderStream.encoding

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

Value

A string, 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