import { text } from "https://deno.land/x/ayonli_jsext@v0.9.72/uint8array/index.ts";
Converts the byte array (or Uint8Array
) to a string.
Examples
Example 1
Example 1
import { text } from "@ayonli/jsext/bytes";
const arr = new Uint8Array([72, 101, 108, 108, 111, 44, 32, 87, 111, 114, 108, 100, 33]);
console.log(text(arr)); // "Hello, World!"
console.log(text(arr, "hex")); // "48656c6c6f2c20576f726c6421"
console.log(text(arr, "base64")); // "SGVsbG8sIFdvcmxkIQ=="