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<ArrayBufferLike>,
opts: Options,
): string;

Parameters

The array of bytes to convert.

Type

let bytes_: Uint8Array<ArrayBufferLike>;

Optional parameters for the conversion.

Type

let opts: Options;

Returns

let returnType: string;

The resulting string.