Polkadot Apps
    Preparing search index...

    Decode a hexadecimal string into a Uint8Array.

    Hex string to decode (no 0x prefix expected).

    The decoded bytes.

    • Convert hex string to byte array. Uses built-in function, when available.

      Parameters

      • hex: string

        hexadecimal string to decode

      Returns Uint8Array<ArrayBufferLike> & Uint8Array<ArrayBuffer>

      Decoded bytes.

      On wrong argument types. TypeError

      On wrong argument ranges or values. RangeError

      Decode lowercase hexadecimal into bytes.

      hexToBytes('cafe0123'); // Uint8Array.from([0xca, 0xfe, 0x01, 0x23])