Skip to main content

hexToBytes() function

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

Converts a hex string (with or without prefix) to a byte array (Uint8Array)

Signature:

export declare function hexToBytes(hexString: string): Uint8Array

Parameters

ParameterTypeDescription
hexStringstringThe string representing the encoding

Returns:

Uint8Array

the Uint8Array represented by the given string

Exceptions

illegal_argument error if the parameter is not a string

This API may change without a BREAKING CHANGE notice.