Skip to main content

bytesToHex() function

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

Converts a Uint8Array input to a hex string

Signature:

export declare function bytesToHex(byteArray: Uint8Array, prefix?: boolean): string

Parameters

ParameterTypeDescription
byteArrayUint8ArrayThe array to be converted
prefixboolean(Optional) If this is set to true, the resulting hex string will be prefixed with 0x

Returns:

string

the hex encoding of the input byte array

Exceptions

illegal_argument error if the input is not a Uint8Array

This API may change without a BREAKING CHANGE notice.