bytesToString

Converts an array of bytes to a string using UTF-8 encoding.

Example

import { bytesToString } from "thirdweb/utils";
const bytes = new Uint8Array([72, 101, 108, 108, 111]);
const string = bytesToString(bytes);
console.log(string); // "Hello"
function bytesToString(
bytes_: Uint8Array,
): string;

Parameters

The array of bytes to convert.

Type

let bytes_: Uint8Array;

Optional parameters for the conversion.

Type

let opts: { size?: number };

Returns

let returnType: string;

The resulting string.