Bun API Reference
This is the complete API reference for Bun, documenting all available APIs, types, and functions. Use the sidebar navigation to browse modules and specific APIs, which are color-coded by type.
This documentation is generated from Bun's TypeScript definitions, which you can find in the oven-sh/bun repository under packages/bun-types
.
Core runtime APIs for file system, networking, processes, and more.
Foreign Function Interface for calling native C functions from JavaScript.
Low-level JavaScript Core engine APIs for advanced use cases.
Built-in SQLite database integration with a simple, performant API.
Testing utilities for writing unit and integration tests.
Variables and classes that exist in Bun's global scope
APIs for the node:assert module.
APIs for the node:async_hooks module.
APIs for the node:buffer module.
APIs for the node:child_process module.
APIs for the node:cluster module.
APIs for the node:crypto module.
APIs for the node:dgram module.
APIs for the node:diagnostics_channel module.
APIs for the node:dns module.
APIs for the node:dns/promises module.
APIs for the node:events module.
APIs for the node:fs module.
APIs for the node:fs/promises module.
APIs for the node:http module.
APIs for the node:http2 module.
APIs for the node:https module.
APIs for the node:module module.
APIs for the node:net module.
APIs for the node:os module.
APIs for the node:path module.
APIs for the node:perf_hooks module.
APIs for the node:punycode module.
APIs for the node:querystring module.
APIs for the node:readline module.
APIs for the node:readline/promises module.
APIs for the node:stream module.
APIs for the node:stream/consumers module.
APIs for the node:stream/promises module.
APIs for the node:stream/web module.
APIs for the node:string_decoder module.
APIs for the node:test module.
APIs for the node:test/reporters module.
APIs for the node:timers/promises module.
APIs for the node:tls module.
APIs for the node:trace_events module.
APIs for the node:tty module.
APIs for the node:url module.
APIs for the node:util module.
APIs for the node:util/types module.
APIs for the node:v8 module.
APIs for the node:vm module.
APIs for the node:wasi module.
APIs for the node:worker_threads module.
APIs for the node:zlib module.