Skip to main content

hexToBytes

Callable

  • hexToBytes(bytes: string): Uint8Array

  • Convert a hex string to a byte array

    @example
    console.log(web3.utils.hexToBytes('0x74657374'));
    > Uint8Array(4) [ 116, 101, 115, 116 ]

    Parameters

    • bytes: string

    Returns Uint8Array

    • The byte array representation of the input hex string