numberToBytes

Converts a number to bytes.

Example

import { numberToBytes } from "thirdweb/utils";
const bytes = numberToBytes(420);
console.log(bytes); // Uint8Array(2) [ 1, 164 ]
function numberToBytes(
value: number | bigint,
opts?: Options,
): Uint8Array;

Parameters

The number to convert.

Type

let value: number | bigint;

Options for converting the number to hex.

Type

let opts: Options;

Returns

let returnType: Uint8Array;

The bytes representation of the number.