TextEncoder takes code points and returns UTF-8 bytes.

Hierarchy

  • TextEncoder

Implements

  • TextEncoderCommon

Constructors

Properties

Methods

Constructors

Properties

encoding: "utf-8" = 'utf-8'

Always returns 'utf-8'.

Methods

  • Encode the given string into a byte array.

    Parameters

    • input: string = ''

      the string to encode.

    Returns Uint8Array

  • Encode the given string and store the results in the given buffer.

    Returns

    an object describing the progress made in this call (code points read and bytes written).

    Parameters

    • input: string

      the string to encode.

    • destination: Uint8Array

      the buffer where the encoded string should be stored.

    Returns TextEncoderEncodeIntoResult