import { encodeBase64 } from "https://deno.land/x/ayonli_jsext@v0.9.72/esm/encoding.js";
Encodes the given data to a base64 string.
Unlike the built-in btoa
function, this function is not limited to the
Latin1 range.
Examples
Example 1
Example 1
import { encodeBase64 } from "@ayonli/jsext/encoding";
const base64 = encodeBase64("Hello, World!");
console.log(base64); // "SGVsbG8sIFdvcmxkIQ=="
const base64_2 = encodeBase64("你好,世界!");
console.log(base64_2); // "5L2g5aW977yM5LiW55WM77yB"