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.
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.
Binary data
Convert an ArrayBuffer to an array of numbers
Convert an ArrayBuffer to a Blob
Convert an ArrayBuffer to a Buffer
Convert an ArrayBuffer to a string
Convert an ArrayBuffer to a Uint8Array
Convert a Blob to an ArrayBuffer
Convert a Blob to a ReadableStream
Convert a Blob to a Uint8Array
Convert a Buffer to an ArrayBuffer
Convert a Buffer to a ReadableStream
Convert a Buffer to a Uint8Array
Convert a DataView to a string
Convert a Uint8Array to an ArrayBuffer
Convert a Uint8Array to a Blob
Convert a Uint8Array to a Buffer
Convert a Uint8Array to a DataView
Ecosystem
Build an app with Nuxt and Bun
Build an app with Qwik and Bun
Build an app with Astro and Bun
Build an app with Remix and Bun
Run Bun as a daemon with systemd
Build an app with Next.js and Bun
Deploy a Bun application on Render
Build an app with SvelteKit and Bun
Build a frontend using Vite and Bun
Build an app with SolidStart and Bun
Use Neon Postgres through Drizzle ORM
Build an HTTP server using Hono and Bun
Use Neon's Serverless Postgres with Bun
Build an HTTP server using Elysia and Bun
Containerize a Bun application with Docker
Build an HTTP server using Express and Bun
Server-side render (SSR) a React component
HTTP
Start a cluster of HTTP servers
Configure TLS on an HTTP server
Send an HTTP request using fetch
Proxy HTTP requests using fetch()
Stream a file as an HTTP Response
Upload files via HTTP using FormData
fetch with unix domain sockets in Bun
Package manager
Using bun install with Artifactory
Generate a human-readable lockfile
Migrate from npm install to bun install
Configuring a monorepo using workspaces
Install a package under a different name
Configure git to diff Bun's lockb lockfile
Install dependencies with Bun in GitHub Actions
Override the default npm registry for bun install
Using bun install with an Azure Artifacts npm registry
Configure a private registry for an organization scope with bun install
Processes
Read stderr from a child process
Read stdout from a child process
Reading files
Runtime
Debugging Bun with the web debugger
Install and run Bun in GitHub Actions
Install TypeScript declarations for Bun
Streams
Convert a ReadableStream to JSON
Convert a Node.js Readable to JSON
Convert a ReadableStream to a Blob
Convert a Node.js Readable to a Blob
Convert a ReadableStream to a Buffer
Convert a ReadableStream to a string
Convert a Node.js Readable to a string
Convert a ReadableStream to a Uint8Array
Convert a ReadableStream to an ArrayBuffer
Convert a Node.js Readable to an Uint8Array
Test runner
Using Testing Library with Bun
Run tests in watch mode with Bun
Use snapshot testing in bun test
Bail early with the Bun test runner
Skip tests with the Bun test runner
Migrate from Jest to Bun's test runner
Run your tests with the Bun test runner
Set the system time in Bun's test runner
Write browser DOM tests with Bun and happy-dom
Set a per-test timeout with the Bun test runner
Mark a test as a "todo" with the Bun test runner
Re-run tests multiple times with the Bun test runner
Utilities
Encode and decode base64 strings
Check if two objects are deeply equal
Detect when code is executed with Bun
Get the directory of the current file
Get the file name of the current file
Convert a file URL to an absolute path
Compress and decompress data with gzip
Convert an absolute path to a file URL
Get the path to an executable bin file
Sleep for a fixed number of milliseconds
Compress and decompress data with DEFLATE
Get the absolute path of the current file