fromBytes

Converts a Uint8Array to the specified type.

Example

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

Parameters

The Uint8Array to convert.

Type

let bytes: Uint8Array<ArrayBufferLike>;

The target type or conversion options.

Type

let toOrOpts: FromBytesParameters<TTo>;

Returns

let returnType: FromBytesReturnType<TTo>;

The converted value of the specified type.