mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 10:28:47 +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.
Bun type definitions
This has type definitions for Bun.js APIs. The type definitions are merged into a single file and copied to ../../packages/bun-types/types.d.ts.
Adding a new file
- Add it to ./index.d.ts
- Add it to ./paths.txt
How to generate types.d.ts
./bundle.ts merges the types in this folder into a single file.
To run it:
bun ./bundle.ts ../../packages/bun-types