AphrodyBun GitHub

Runtime docs · Runtime · Standards & Compatibility

Web APIs

Web-standard APIs supported by Bun for server-side JavaScript

Some Web APIs, like the DOM API and History API, aren't relevant in a server-first runtime like Bun. Many others are broadly useful outside the browser; when possible, Bun implements these Web-standard APIs instead of introducing new ones.

Bun partially or completely supports the following Web APIs.

CategoryAPIs
HTTPfetch, Response, Request, Headers, AbortController, AbortSignal
URLsURL, URLSearchParams
Web WorkersWorker, self.postMessage, structuredClone, MessagePort, MessageChannel, BroadcastChannel
StreamsReadableStream, WritableStream, TransformStream, ByteLengthQueuingStrategy, CountQueuingStrategy and associated classes
BlobBlob
WebSocketsWebSocket
Encoding and decodingUint8Array, Uint8Array.prototype.toBase64(), Uint8Array.fromBase64(), TextEncoder, TextDecoder, atob, btoa
JSONJSON
TimeoutssetTimeout, clearTimeout
IntervalssetInterval, clearInterval
Cryptocrypto, SubtleCrypto, CryptoKey
Debuggingconsole, performance
MicrotasksqueueMicrotask
ErrorsreportError
User interactionalert, confirm, prompt (intended for interactive CLIs)
RealmsShadowRealm
EventsEventTarget, Event, ErrorEvent, CloseEvent, MessageEvent