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