Skip to main content

hexToBytes

Callable

  • hexToBytes(bytes: string): Buffer

  • Convert a hex string to a byte array

    @example
    console.log(web3.utils.hexToBytes('0x74657374'));
    > <Buffer 74 65 73 74>

    Parameters

    • bytes: string

    Returns Buffer

    • The byte array representation of the input hex string