Bun

指南工具程式

使用 Bun 編碼與解碼 base64 字串

Bun 實作了 Web 標準 atobbtoa 函數,用於編碼和解碼 base64 字串。

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

請參閱文件 > Web API 以取得 Bun 中實作的 Web API 完整細目。