Skip to content

Bun 實現了 Web 標准的 atobbtoa 函數,用於編碼和解碼 base64 字符串。

ts
const data = "hello world";
const encoded = btoa(data); // => "aGVsbG8gd29ybGQ="
const decoded = atob(encoded); // => "hello world"

請參閱 文檔 > Web APIs 獲取 Bun 中實現的 Web APIs 的完整說明。

Bun學習網由www.bunjs.com.cn整理維護