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