@exodus/bytes
    Preparing search index...
    • Implements decode legacy hook.

      Given a TypedArray or an ArrayBuffer instance input and an optional fallbackEncoding encoding label, sniffs encoding from BOM with fallbackEncoding fallback and then decodes the input using that encoding, skipping BOM if it was present.

      Notes:

      • BOM-sniffed encoding takes precedence over fallbackEncoding option per spec. Use with care.
      • Always operates in non-fatal mode, aka replacement. It can convert different byte sequences to equal strings.

      This method is similar to the following code, except that it doesn't support encoding labels and only expects lowercased encoding name:

      new TextDecoder(getBOMEncoding(input) ?? fallbackEncoding).decode(input)
      

      Parameters

      • input: ArrayBufferLike | ArrayBufferView<ArrayBufferLike>

        The bytes to decode

      • OptionalfallbackEncoding: string

        The encoding to use if no BOM detected (default: 'utf-8')

      Returns string

      The decoded string