Files
bun.sh/docs/runtime/bun-apis.md
Michael H f99efe398d docs: fix link for bun:jsc (#22024)
easy fix to https://x.com/kiritotwt1/status/1958452541718458513/photo/1
as it's generated of the types so should be accurate documentation. in
future it could be better done like what it may have been once upon a
time

(this doesn't fix the error, but it fixes the broken link)
2025-08-22 22:06:46 -07:00

5.4 KiB

Bun implements a set of native APIs on the Bun global object and through a number of built-in modules. These APIs are heavily optimized and represent the canonical "Bun-native" way to implement some common functionality.

Bun strives to implement standard Web APIs wherever possible. Bun introduces new APIs primarily for server-side tasks where no standard exists, such as file I/O and starting an HTTP server. In these cases, Bun's approach still builds atop standard APIs like Blob, URL, and Request.

Bun.serve({
  fetch(req: Request) {
    return new Response("Success!");
  },
});

Click the link in the right column to jump to the associated documentation.

{% table %}

  • Topic
  • APIs


  • Shell
  • $






  • WebSockets
  • new WebSocket() (client), Bun.serve (server)






  • PostgreSQL Client
  • Bun.SQL, Bun.sql


  • FFI (Foreign Function Interface)
  • bun:ffi

















  • Stream Processing
  • Bun.readableStreamTo*(), Bun.readableStreamToBytes(), Bun.readableStreamToBlob(), Bun.readableStreamToFormData(), Bun.readableStreamToJSON(), Bun.readableStreamToArray()

  • Memory & Buffer Management
  • Bun.ArrayBufferSink, Bun.allocUnsafe, Bun.concatArrayBuffers



  • Low-level / Internals
  • Bun.mmap, Bun.gc, Bun.generateHeapSnapshot, bun:jsc

{% /table %}