Bun 實現了 Web 標准的 atob 和 btoa 函數,用於編碼和解碼 base64 字符串。
ts
const data = "hello world";
const encoded = btoa(data); // => "aGVsbG8gd29ybGQ="
const decoded = atob(encoded); // => "hello world"請參閱 文檔 > Web APIs 獲取 Bun 中實現的 Web APIs 的完整說明。