mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 18:38:55 +00:00
These function are confusingly named. `btoa` converts "Binary" to Ascii by encoding the input using base64. `atob` reverses that process by base64 decoding the Ascii input into a "Binary" output. The names come from the Unix utilities with the same names, which "converts a binary file to ascii for transmission over a telephone line" (https://www.unix.com/man-page/minix/1/btoa/) See: - https://developer.mozilla.org/en-US/docs/Web/API/atob - https://developer.mozilla.org/en-US/docs/Web/API/btoa - https://html.spec.whatwg.org/multipage/webappapis.html#dom-btoa-dev Note: the actual implementation of `btoa` and `atob` are correct, but the docs were backwards.