Bun

指南實用程式

使用 Bun 編碼和解碼 Base64 字串

Bun 實現了 Web 標準的 atobbtoa 函式,用於編碼和解碼 Base64 字串。

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

有關 Bun 中實現的 Web API 的完整分類,請參閱文件 > Web API