happy-codec
    Preparing search index...

    Function decodeHex

    • Decodes a hexadecimal string to Uint8Array.

      Uses native Uint8Array.fromHex if available, otherwise pure JS fallback.

      Parameters

      • hex: string

        Hexadecimal string.

      Returns Uint8Array<ArrayBuffer>

      Decoded Uint8Array.

      If the input is not a string.

      If length is odd or contains non-hex characters.

      1.0.0

      const bytes = decodeHex('ff0080');
      console.log(bytes); // Uint8Array [255, 0, 128]