Bun

Node.js compatibility

Bun aims for complete Node.js API compatibility. Most npm packages intended for Node.js environments will work with Bun out of the box; the best way to know for certain is to try it.

This page is updated regularly to reflect compatibility status of the latest version of Bun.

Built-in modules

ModuleStatusNotes
node:assert #🟢Fully implemented.
node:async_hooks #🔴Not implemented.
node:buffer #🟡Incomplete implementation of base64 and base64url encodings.
node:child_process #🟡Missing IPC, Stream stdio, proc.gid, proc.uid, advanced serialization.
node:cluster #🔴Not implemented.
node:console #🟢Recommended to use console global instead
node:crypto #🟡Missing crypto.Certificate crypto.ECDH crypto.KeyObject crypto.X509Certificate crypto.checkPrime{Sync} crypto.createPrivateKey crypto.createPublicKey crypto.createSecretKey crypto.diffieHellman crypto.generateKey{Sync} crypto.generateKeyPair{Sync} crypto.generatePrime{Sync} crypto.getCipherInfo crypto.getCurves crypto.{get|set}Fips crypto.hkdf crypto.hkdfSync crypto.randomInt crypto.secureHeapUsed crypto.setEngine crypto.sign crypto.verify
node:dgram #🔴Not implemented.
node:diagnostics_channel #🔴Not implemented.
node:dns #🟢Fully implemented.
node:domain #🟢Fully implemented.
node:events #🟡Missing EventEmitterAsyncResource. EventEmitter is missing {get}set}MaxListeners usingDomains init.
node:fs #🟡Missing fs.fdatasync{Sync} fs.opendir{Sync} fs.readv{Sync} fs.{watch|watchFile|unwatchFile} fs.writev{Sync}.
node:http #🟢Fully implemented.
node:http2 #🔴Not implemented.
node:https #🟢Fully implemented.
node:inspector #🔴Not implemented.
node:module #🟢Fully implemented.
node:net #🟡Missing net.createServer net.{get|set}DefaultAutoSelectFamily net.SocketAddress net.BlockList.
node:os #🟢Fully implemented.
node:path #🟢Fully implemented.
node:perf_hooks #🟡Only perf_hooks.performance.now() and perf_hooks.performance.timeOrigin are implemented. Recommended to use performance global instead of perf_hooks.performance.
node:process #🟡See Globals > process.
node:punycode #🟢Fully implemented. Deprecated by Node.js.
node:querystring #🟢Fully implemented.
node:readline #🟢Fully implemented.
node:repl #🔴Not implemented.
node:stream #🟢Fully implemented.
node:string_decoder #🟢Fully implemented.
node:sys #🟡See node:util.
node:timers #🟢Recommended to use global setTimeout, et. al. instead.
node:tls #🟡Missing tls.Server tls.createServer tls.createSecurePair tls.checkServerIdentity tls.rootCertificates
node:trace_events #🔴Not implemented.
node:tty #🟡Missing tty.ReadStream and tty.WriteStream.
node:url #🟡Missing url.domainTo{ASCII|Unicode} url.urlToHttpOptions. Recommended to use URL and URLSearchParams globals instead.
node:util #🟡Missing util.MIMEParams util.MIMEType util.formatWithOptions() util.getSystemErrorMap() util.getSystemErrorName() util.parseArgs() util.stripVTControlCharacters() util.toUSVString() util.transferableAbortController() util.transferableAbortSignal().
node:v8 #🔴Not implemented or planned. For profiling, use bun:jsc instead.
node:vm #🟡Partially implemented.
node:wasi #🟡Partially implemented.
node:worker_threads #🔴Not implemented.
node:zlib #🟡Missing zlib.brotli*

Globals

The table below lists all globals implemented by Node.js and Bun's current compatibility status.

AbortController #🟢Fully implemented.
AbortSignal #🟢Fully implemented.
Blob #🟢Fully implemented.
Buffer #🟡Incomplete implementation of base64 and base64url encodings.
ByteLengthQueuingStrategy #🟢Fully implemented.
__dirname #🟢Fully implemented.
__filename #🟢Fully implemented.
atob() #🟢Fully implemented.
BroadcastChannel #🔴Not implemented.
btoa() #🟢Fully implemented.
clearImmediate() #🟢Fully implemented.
clearInterval() #🟢Fully implemented.
clearTimeout() #🟢Fully implemented.
CompressionStream #🔴Not implemented.
console #🟢Fully implemented.
CountQueuingStrategy #🟢Fully implemented.
Crypto #🟢Fully implemented.
crypto #🟢Fully implemented.
CryptoKey #🟢Fully implemented.
CustomEvent #🟢Fully implemented.
DecompressionStream #🔴Not implemented.
Event #🟢Fully implemented.
EventTarget #🟢Fully implemented.
exports #🟢Fully implemented.
fetch #🟢Fully implemented.
FormData #🟢Fully implemented. Added in Bun 0.5.7.
global #🟢Implemented. This is an object containing all objects in the global namespace. It's rarely referenced directly, as its contents are available without an additional prefix, e.g. __dirname instead of global.__dirname.
globalThis #🟢Aliases to global.
Headers #🟢Fully implemented.
MessageChannel #🔴Not implemented.
MessageEvent #🟢Fully implemented.
MessagePort #🔴Not implemented.
module #🟢Fully implemented.
PerformanceEntry #🔴Not implemented.
PerformanceMark #🔴Not implemented.
PerformanceMeasure #🔴Not implemented.
PerformanceObserver #🔴Not implemented.
PerformanceObserverEntryList #🔴Not implemented.
PerformanceResourceTiming #🔴Not implemented.
performance #🟢Fully implemented.
process #🟡Missing process.allowedNodeEnvironmentFlags process.channel() process.connected process.constrainedMemory() process.cpuUsage() process.debugPort process.disconnect() process.{get|set}ActiveResourcesInfo() process.{get|set}{uid|gid|egid|euid|groups}() process.hasUncaughtExceptionCaptureCallback process.initGroups() process.kill() process.listenerCount process.memoryUsage() process.report process.resourceUsage() process.setSourceMapsEnabled() process.send().
queueMicrotask() #🟢Fully implemented.
ReadableByteStreamController #🟢Fully implemented.
ReadableStream #🟢Fully implemented.
ReadableStreamBYOBReader #🔴Not implemented.
ReadableStreamBYOBRequest #🔴Not implemented.
ReadableStreamDefaultController #🟢Fully implemented.
ReadableStreamDefaultReader #🟢Fully implemented.
require() #🟢Fully implemented.
Response #🟢Fully implemented.
Request #🟢Fully implemented.
setImmediate() #🟢Fully implemented.
setInterval() #🟢Fully implemented.
setTimeout() #🟢Fully implemented.
structuredClone() #🔴Not implemented.
SubtleCrypto #🟢Fully implemented.
DOMException #🟢Fully implemented.
TextDecoder #🟢Fully implemented.
TextDecoderStream #🔴Not implemented.
TextEncoder #🟢Fully implemented.
TextEncoderStream #🔴Not implemented.
TransformStream #🟢Fully implemented.
TransformStreamDefaultController #🟢Fully implemented.
URL #🟢Fully implemented.
URLSearchParams #🟢Fully implemented.
WebAssembly #🟢Fully implemented.
WritableStream #🟢Fully implemented.
WritableStreamDefaultController #🟢Fully implemented.
WritableStreamDefaultWriter #🟢Fully implemented.