Function hexToBytes

  • Convert a hexadecimal string to a Uint8Array. The string can optionally be prefixed with 0x. It accepts even and odd length strings.

    If the value is "0x", an empty Uint8Array is returned.

    Returns

    The bytes as Uint8Array.

    Parameters

    • value: string

      The hexadecimal string to convert to bytes.

    Returns Uint8Array