Converts a byte-like value to a string using the specified encoding.
The byte-like value to convert.
The encoding to use for the conversion, as defined by the BytesFromEncoding type.
A string representing the encoded bytes.
const encodedString = bytesTo(new Uint8Array([104, 101, 108, 108, 111]), "utf8");console.log(encodedString); // Outputs "hello"const base64String = bytesTo(new Uint8Array([104, 101, 108, 108, 111]), "base64");console.log(base64String); // Outputs "aGVsbG8=" Copy
const encodedString = bytesTo(new Uint8Array([104, 101, 108, 108, 111]), "utf8");console.log(encodedString); // Outputs "hello"const base64String = bytesTo(new Uint8Array([104, 101, 108, 108, 111]), "base64");console.log(base64String); // Outputs "aGVsbG8="
Converts a byte-like value to a string using the specified encoding.