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. The information below reflects Bun's compatibility with Node.js v20. If you run into any bugs with a particular package, please open an issue. Opening issues for compatibility bugs helps us prioritize what to work on next.
Built-in modules
node:assert
🟡 Missing doesNotMatch
node:async_hooks
🟡 Only AsyncLocalStorage
, and AsyncResource
are implemented. AsyncResource
is missing bind
.
node:buffer
🟢 Fully implemented.
node:child_process
🟡 Missing Stream
stdio, proc.gid
proc.uid
. IPC has partial support and only current only works with other bun
processes.
node:cluster
🔴 Not implemented.
node:console
🟢 Fully implemented.
node:crypto
🟡 Missing Certificate
ECDH
X509Certificate
checkPrime
checkPrimeSync
diffieHellman
generatePrime
generatePrimeSync
getCipherInfo
getFips
hkdf
hkdfSync
secureHeapUsed
setEngine
setFips
Some methods are not optimized yet.
node:dgram
🔴 Not implemented.
node:diagnostics_channel
🟢 Fully implemented.
node:dns
🟡 Missing cancel
setServers
getDefaultResultOrder
node:domain
🟡 Missing Domain
active
node:events
🟡 Missing on
addAbortListener
getMaxListeners
node:fs
🟡 Missing Dir
fdatasync
fdatasyncSync
openAsBlob
opendir
opendirSync
statfs
statfsSync
. fs.promises.open
incorrectly returns a file descriptor instead of a FileHandle
.
node:http
🟢 Fully implemented.
node:http2
🟡 Client is supported, but server isn't yet.
node:https
🟢 Fully implemented.
node:inspector
🔴 Not implemented.
node:module
🟢 Missing runMain
syncBuiltinESMExports
, Module#load()
. Attempts to override or patch the module cache will fail.
node:net
🟡 Missing BlockList
SocketAddress
Stream
getDefaultAutoSelectFamily
getDefaultAutoSelectFamilyAttemptTimeout
setDefaultAutoSelectFamily
setDefaultAutoSelectFamilyAttemptTimeout
Server#ref()
Server#unref()
Socket#ref()
Socket#unref()
.
node:os
🟢 Fully implemented.
node:path
🟢 Fully implemented.
node:perf_hooks
🟡 Only perf_hooks.performance.now()
and perf_hooks.performance.timeOrigin
are implemented. Missing Performance
PerformanceMark
PerformanceMeasure
PerformanceObserverEntryList
PerformanceResourceTiming
createHistogram
monitorEventLoopDelay
. It's recommended to use performance
global instead of perf_hooks.performance
.
node:process
🟡 See process
Global.
node:punycode
🟢 Fully implemented. Deprecated by Node.js.
node:querystring
🟢 Fully implemented.
node:readline
🟢 Fully implemented.
node:repl
🔴 Not implemented.
node:stream
🟡 Missing getDefaultHighWaterMark
setDefaultHighWaterMark
node:string_decoder
🟢 Fully implemented.
node:sys
🟡 See node:util
.
node:timers
🟢 Recommended to use global setTimeout
, et. al. instead.
node:tls
🟡 Missing tls.createSecurePair
.
node:trace_events
🔴 Not implemented.
node:tty
🟢 Fully implemented.
node:url
🟡 Missing domainToASCII
domainToUnicode
. It's recommended to use URL
and URLSearchParams
globals instead.
node:util
🟡 Missing MIMEParams
MIMEType
aborted
debug
getSystemErrorMap
getSystemErrorName
transferableAbortController
transferableAbortSignal
stripVTControlCharacters
node:v8
🔴 serialize
and deserialize
use JavaScriptCore's wire format instead of V8's. Otherwise, not implemented. For profiling, use bun:jsc
instead.
node:vm
🟡 Core functionality works, but experimental VM ES modules are not implemented, including vm.Module
, vm.SourceTextModule
, vm.SyntheticModule
,importModuleDynamically
, and vm.measureMemory
. Options like timeout
, breakOnSigint
, cachedData
are not implemented yet. There is a bug with this
value for contextified options not having the correct prototype.
node:wasi
🟡 Partially implemented.
node:worker_threads
🟡 Worker
doesn't support the following options: eval
argv
execArgv
stdin
stdout
stderr
trackedUnmanagedFds
resourceLimits
. Missing markAsUntransferable
moveMessagePortToContext
getHeapSnapshot
.
node:zlib
🟡 Missing BrotliCompress
BrotliDecompress
brotliCompressSync
brotliDecompress
brotliDecompressSync
createBrotliCompress
createBrotliDecompress
. Unoptimized.
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
🟢 Fully 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.
SubtleCrypto (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.
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
🟢 Fully implemented.
MessageEvent
🟢 Fully implemented.
MessagePort
🟢 Fully 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 domain
hasUncaughtExceptionCaptureCallback
initgroups
report
resourceUsage
setUncaughtExceptionCaptureCallback
setegid
seteuid
setgid
setgroups
setuid
allowedNodeEnvironmentFlags
getActiveResourcesInfo
setActiveResourcesInfo
moduleLoadList
setSourceMapsEnabled
channel
. process.binding
is partially implemented.
queueMicrotask()
🟢 Fully implemented.
ReadableByteStreamController
🟢 Fully implemented.
ReadableStream
🟢 Fully implemented.
ReadableStreamBYOBReader
🔴 Not implemented.
ReadableStreamBYOBRequest
🔴 Not implemented.
ReadableStreamDefaultController
🟢 Fully implemented.
ReadableStreamDefaultReader
🟢 Fully implemented.
require()
🟢 Fully implemented, including require.main
, require.cache
, require.resolve
Response
🟢 Fully implemented.
Request
🟢 Fully implemented.
setImmediate()
🟢 Fully implemented.
setInterval()
🟢 Fully implemented.
setTimeout()
🟢 Fully implemented.
structuredClone()
🟢 Fully 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.