bytesToNumber

Converts a Uint8Array of bytes to a number.

Example

import { bytesToNumber } from "thirdweb/utils";
const bytes = new Uint8Array([1, 164]);
const number = bytesToNumber(bytes);
console.log(number); // 420
function bytesToNumber(
bytes: Uint8Array<ArrayBufferLike>,
): number;

Parameters

The Uint8Array of bytes to convert.

Type

let bytes: Uint8Array<ArrayBufferLike>;

Optional configuration options.

Type

let opts: { signed?: boolean; size?: number };

Returns

let returnType: number;

The converted number.