MLE text encoding API(mle-js-encodings)
    Preparing search index...

    Class TextDecoder

    TextDecoder represents a decoder for specific text encoding, such UTF-8, UTF-16, etc. A decoder takes as input bytes and returns as output code points.

    Implements

    • TextDecoderCommon
    Index

    Constructors

    Properties

    Methods

    Constructors

    • Create a new TextDecoder instance. Currently, the following encodings are supported: utf-8, utf-16be, utf-16le, utf-16 (alias to utf-16le).

      Parameters

      • label: string = 'utf-8'

        the name of the encoding to be used when decoding. Default: 'utf-8'.

      • options: TextDecoderOptions = {}

        the decoder options (an object with properties fatal and ignoreBOM).

      Returns TextDecoder

    Properties

    encoding: string

    The name of the decoder that will be used.

    fatal: boolean

    Error mode can be either be 'replacement' (replace code point) or 'fatal' (throw exception),

    ignoreBOM: boolean

    Whether the byte order mark will be ignored.

    Methods

    • Decodes the given bytes with the method given in encoding.

      Parameters

      • input: AllowSharedBufferSource = null

        the bytes to decode, given as an ArrayBuffer or ArrayBufferView.

      • options: TextDecodeOptions = {}

        object with the stream property. stream specifies whether data will follow in subsequent calls. Should be set to true if processing data in chunks.

      Returns string