Bun Encode and decode base64 strings

Encode and decode base64 strings

jarle Updated

File contents

Encode and decode base64 strings

Bun implements the Web-standard atob and btoa functions for encoding and decoding base64 strings.

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

See Docs > Web APIs for a complete breakdown of the Web APIs implemented in Bun.

jarle/bun-skills/tree/main/skills/bun-guides-util-base64 commit 38da1e3891

Frequently asked questions

npx skillmds@latest add jarle/bun-encode-and-decode-base64-strings