Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface IEncoding

Represents a character encoding.

Hierarchy

  • IEncoding

Index

Methods

byteLength

  • byteLength(str: string): number
  • Returns the byte length of a string when encoded using this encoding

    Parameters

    • str: string

      A value to calculate the length of.

    Returns number

Optional decode

  • decode(buf: Buffer): string
  • Decode a buffer to a string. Any incomplete characters will be replaced with substitution characters appropriate for the character encoding.

    Parameters

    • buf: Buffer

      A buffer to decode.

    Returns string

encode

  • encode(str: string): Buffer
  • Encode a string to a buffer. Any incomplete characters will be replaced with substitution characters and encoded appropriate for the character encoding.

    Parameters

    • str: string

      A string to encode.

    Returns Buffer

getDecoder

Optional getEncoder

  • Obtains an encoder that converts a sequence of Unicode characters into an encoded sequence of bytes.

    Returns IEncoder

Generated using TypeDoc