Back to Content

TextDecoderStream

files/en-us/web/api/textdecoderstream/index.md

latest1.8 KB
Original Source

{{APIRef("Encoding API")}}{{AvailableInWorkers}}

The TextDecoderStream interface of the {{domxref('Encoding API','','',' ')}} converts a stream of text in a binary encoding, such as UTF-8 etc., to a stream of strings. It is the streaming equivalent of {{domxref("TextDecoder")}}. It implements the same shape as a {{domxref("TransformStream")}}, allowing it to be used in {{domxref("ReadableStream.pipeThrough()")}} and similar methods.

Constructor

  • {{domxref("TextDecoderStream.TextDecoderStream","TextDecoderStream()")}}
    • : Creates a new TextDecoderStream object.

Instance properties

  • {{DOMxRef("TextDecoderStream.encoding")}} {{ReadOnlyInline}}
    • : An encoding.
  • {{DOMxRef("TextDecoderStream.fatal")}} {{ReadOnlyInline}}
    • : A {{jsxref("boolean")}} indicating if the error mode is fatal.
  • {{DOMxRef("TextDecoderStream.ignoreBOM")}} {{ReadOnlyInline}}
    • : A {{jsxref("boolean")}} indicating whether the byte order mark is ignored.
  • {{DOMxRef("TextDecoderStream.readable")}} {{ReadOnlyInline}}
    • : Returns the {{domxref("ReadableStream")}} instance controlled by this object.
  • {{DOMxRef("TextDecoderStream.writable")}} {{ReadOnlyInline}}
    • : Returns the {{domxref("WritableStream")}} instance controlled by this object.

Examples

Examples of streaming structured data and HTML

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}

See also