hexToBytes

Converts a hexadecimal string to a Uint8Array of bytes.

Example

import { hexToBytes } from "thirdweb/utils";
const bytes = hexToBytes("0x1a4");
console.log(bytes); // Uint8Array(2) [ 1, 164 ]
function hexToBytes(hex_: `0x${string}`, opts: Options): Uint8Array;

Parameters

The hexadecimal string to convert.

Type

let hex_: `0x${string}`;

Options for converting the hexadecimal string.

Type

let opts: Options;

Returns

let returnType: Uint8Array;

The Uint8Array of bytes.