Skip to main content
Overview
Deployment
Runtime & Debugging
Utilities
Ecosystem & Frameworks
- Astro with Bun
- Discord.js with Bun
- Docker with Bun
- Drizzle with Bun
- Gel with Bun
- Elysia with Bun
- Express with Bun
- Hono with Bun
- Mongoose with Bun
- Neon Drizzle with Bun
- Neon Serverless Postgres with Bun
- Next.js with Bun
- Nuxt with Bun
- PM2 with Bun
- Prisma ORM with Bun
- Prisma Postgres with Bun
- Qwik with Bun
- React with Bun
- Remix with Bun
- TanStack Start with Bun
- Sentry with Bun
- SolidStart with Bun
- SSR React with Bun
- StricJS with Bun
- SvelteKit with Bun
- systemd with Bun
- Vite with Bun
- Upstash with Bun
HTTP & Networking
- HTTP Server with Bun
- Simple HTTP Server with Bun
- Fetch with Bun
- Hot reload an HTTP server
- Start a cluster of HTTP servers
- Configure TLS
- Proxy HTTP requests using fetch()
- Stream file response
- Upload files via HTTP using FormData
- Fetch with unix domain sockets
- Stream with iterators
- Server-Sent Events
- Stream with Node.js
Processes & System
Package Manager
- Add a dependency
- Add a dev dependency
- Add an optional dependency
- Add a peer dependency
- Add a Git dependency
- Add a tarball dependency
- Install with alias
- Workspaces with Bun
- Override the default npm registry
- Configure a scoped registry
- Azure Artifacts with Bun
- JFrog Artifactory with Bun
- Add a trusted dependency
- Generate a yarn-compatible lockfile
- Migrate from npm to bun
- Configure git to diff Bun's lockfile
- Install Bun in GitHub Actions
Test Runner
Runtime & Debugging
Module System
File System
- Read as string
- Read to Buffer
- Read to Uint8Array
- Read to ArrayBuffer
- Read JSON file
- Get MIME type
- Check file exists
- Watch directory
- Read as stream
- Write string to file
- Write Blob
- Write Response
- Append to file
- Incremental write
- Write stream
- Write to stdout
- Write file to stdout
- Copy file
- Delete file
- Delete files
- Delete directories
Utilities
HTML Processing
Binary Data
- ArrayBuffer to string
- ArrayBuffer to Buffer
- ArrayBuffer to Blob
- ArrayBuffer to Array
- ArrayBuffer to Uint8Array
- Buffer to string
- Buffer to ArrayBuffer
- Buffer to Blob
- Buffer to Uint8Array
- Buffer to ReadableStream
- Blob to string
- Blob to ArrayBuffer
- Blob to Uint8Array
- Blob to DataView
- Blob to ReadableStream
- Uint8Array to string
- Uint8Array to ArrayBuffer
- Uint8Array to Buffer
- Uint8Array to Blob
- Uint8Array to DataView
- Uint8Array to ReadableStream
- DataView to string
Binary Data
Convert an ArrayBuffer to a Buffer
The Node.js
To create a
See Docs > API > Binary Data for complete documentation on manipulating binary data with Bun.
Buffer API predates the introduction of ArrayBuffer into the JavaScript language. Bun implements both.
Use the static Buffer.from() method to create a Buffer from an ArrayBuffer.
const arrBuffer = new ArrayBuffer(64);
const nodeBuffer = Buffer.from(arrBuffer);
To create a
Buffer that only views a portion of the underlying buffer, pass the offset and length to the constructor.
const arrBuffer = new ArrayBuffer(64);
const nodeBuffer = Buffer.from(arrBuffer, 0, 16); // view first 16 bytes
See Docs > API > Binary Data for complete documentation on manipulating binary data with Bun.
Was this page helpful?
⌘I
