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。