# Node.js Compatibility (/docs/runtime/nodejs-compat)

<!-- agent-signals: reading_time_min: 6 · est_tokens: 4636 · updated: 2026-07-28 -->
Related: [Watch Mode](/docs/runtime/watch-mode.md), [Debugging](/docs/runtime/debugger.md), [REPL](/docs/runtime/repl.md), [bunfig.toml](/docs/runtime/bunfig.md), [File Types](/docs/runtime/file-types.md), [Module Resolution](/docs/runtime/module-resolution.md)

Every day, Bun gets closer to 100% Node.js API compatibility. Popular frameworks like Next.js, Express, and millions of `npm` packages intended for Node.js work with Bun. To ensure compatibility, we run thousands of tests from Node.js' test suite before every release of Bun.

**If a package works in Node.js but doesn't work in Bun, we consider it a bug in Bun.** [Open an issue](https://bun.com/issues) and we'll fix it.

This page is updated regularly and reflects the latest version of Bun's compatibility with *Node.js v23*.

## Built-in Node.js modules [#built-in-nodejs-modules]

### [`node:assert`](https://nodejs.org/api/assert.html) [#nodeassert]

🟢 Fully implemented.

### [`node:buffer`](https://nodejs.org/api/buffer.html) [#nodebuffer]

🟢 Fully implemented.

### [`node:console`](https://nodejs.org/api/console.html) [#nodeconsole]

🟢 Fully implemented.

### [`node:dgram`](https://nodejs.org/api/dgram.html) [#nodedgram]

🟢 Fully implemented. > 90% of Node.js's test suite passes.

### [`node:diagnostics_channel`](https://nodejs.org/api/diagnostics_channel.html) [#nodediagnostics_channel]

🟢 Fully implemented.

### [`node:dns`](https://nodejs.org/api/dns.html) [#nodedns]

🟢 Fully implemented. > 90% of Node.js's test suite passes.

### [`node:events`](https://nodejs.org/api/events.html) [#nodeevents]

🟢 Fully implemented. 100% of Node.js's test suite passes. `EventEmitterAsyncResource` uses `AsyncResource` underneath.

### [`node:fs`](https://nodejs.org/api/fs.html) [#nodefs]

🟢 Fully implemented. 92% of Node.js's test suite passes.

### [`node:http`](https://nodejs.org/api/http.html) [#nodehttp]

🟢 Fully implemented. The outgoing client request body is buffered instead of streamed.

### [`node:https`](https://nodejs.org/api/https.html) [#nodehttps]

🟢 APIs are implemented, but `Agent` is not always used.

### [`node:os`](https://nodejs.org/api/os.html) [#nodeos]

🟢 Fully implemented. 100% of Node.js's test suite passes.

### [`node:path`](https://nodejs.org/api/path.html) [#nodepath]

🟢 Fully implemented. 100% of Node.js's test suite passes.

### [`node:punycode`](https://nodejs.org/api/punycode.html) [#nodepunycode]

🟢 Fully implemented. 100% of Node.js's test suite passes, *deprecated by Node.js*.

### [`node:querystring`](https://nodejs.org/api/querystring.html) [#nodequerystring]

🟢 Fully implemented. 100% of Node.js's test suite passes.

### [`node:readline`](https://nodejs.org/api/readline.html) [#nodereadline]

🟢 Fully implemented.

### [`node:stream`](https://nodejs.org/api/stream.html) [#nodestream]

🟢 Fully implemented.

### [`node:string_decoder`](https://nodejs.org/api/string_decoder.html) [#nodestring_decoder]

🟢 Fully implemented. 100% of Node.js's test suite passes.

### [`node:timers`](https://nodejs.org/api/timers.html) [#nodetimers]

🟢 Use the global `setTimeout` and related functions instead.

### [`node:tty`](https://nodejs.org/api/tty.html) [#nodetty]

🟢 Fully implemented.

### [`node:url`](https://nodejs.org/api/url.html) [#nodeurl]

🟢 Fully implemented.

### [`node:zlib`](https://nodejs.org/api/zlib.html) [#nodezlib]

🟢 Fully implemented. 98% of Node.js's test suite passes.

### [`node:async_hooks`](https://nodejs.org/api/async_hooks.html) [#nodeasync_hooks]

🟡 `AsyncLocalStorage` and `AsyncResource` are implemented. v8 promise hooks are not called, and its usage is [strongly discouraged](https://nodejs.org/docs/latest/api/async_hooks.html#async-hooks).

### [`node:child_process`](https://nodejs.org/api/child_process.html) [#nodechild_process]

🟡 Missing `proc.gid` `proc.uid`. `Stream` class not exported. IPC cannot send socket handles. Node.js ↔ Bun IPC can be used with JSON serialization.

### [`node:cluster`](https://nodejs.org/api/cluster.html) [#nodecluster]

🟡 Handles and file descriptors cannot be passed between workers, so load-balancing HTTP requests across processes is only supported on Linux (through `SO_REUSEPORT`). Otherwise, implemented but not battle-tested.

### [`node:crypto`](https://nodejs.org/api/crypto.html) [#nodecrypto]

🟡 Missing `secureHeapUsed` `setEngine` `setFips`

### [`node:domain`](https://nodejs.org/api/domain.html) [#nodedomain]

🟡 Missing `Domain` `active`

### [`node:http2`](https://nodejs.org/api/http2.html) [#nodehttp2]

🟡 Client & server are implemented (95.25% of gRPC's test suite passes).

### [`node:module`](https://nodejs.org/api/module.html) [#nodemodule]

🟡 Missing `syncBuiltinESMExports`, `Module#load()`. Overriding `require.cache` is supported for ESM & CJS modules. `module._extensions`, `module._pathCache`, `module._cache` are no-ops. `module.register` is not implemented; we recommend [`Bun.plugin`](/runtime/plugins) instead.

### [`node:net`](https://nodejs.org/api/net.html) [#nodenet]

🟢 Fully implemented.

### [`node:perf_hooks`](https://nodejs.org/api/perf_hooks.html) [#nodeperf_hooks]

🟡 APIs are implemented, but the Node.js test suite for this module does not pass.

### [`node:process`](https://nodejs.org/api/process.html) [#nodeprocess]

🟡 See [`process`](#process) Global.

### [`node:sys`](https://nodejs.org/api/util.html) [#nodesys]

🟡 See [`node:util`](#node-util).

### [`node:tls`](https://nodejs.org/api/tls.html) [#nodetls]

🟡 Missing `tls.createSecurePair`.

### [`node:util`](https://nodejs.org/api/util.html) [#nodeutil]

🟡 Missing `getCallSite` `getCallSites` `getSystemErrorMap` `getSystemErrorMessage` `transferableAbortSignal` `transferableAbortController`

### [`node:v8`](https://nodejs.org/api/v8.html) [#nodev8]

🟡 `writeHeapSnapshot` and `getHeapSnapshot` are implemented. `serialize` and `deserialize` use JavaScriptCore's wire format instead of V8's. Other methods are not implemented. For profiling, use [`bun:jsc`](/project/benchmarking#javascript-heap-stats) instead.

### [`node:vm`](https://nodejs.org/api/vm.html) [#nodevm]

🟡 Core functionality and ES modules are implemented, including `vm.Script`, `vm.createContext`, `vm.runInContext`, `vm.runInNewContext`, `vm.runInThisContext`, `vm.compileFunction`, `vm.isContext`, `vm.Module`, `vm.SourceTextModule`, `vm.SyntheticModule`, and `importModuleDynamically` support. Options like `timeout` and `breakOnSigint` are fully supported.

### [`node:wasi`](https://nodejs.org/api/wasi.html) [#nodewasi]

🟡 Partially implemented.

### [`node:worker_threads`](https://nodejs.org/api/worker_threads.html) [#nodeworker_threads]

🟡 `Worker` doesn't support the following options: `stdin` `stdout` `stderr` `trackedUnmanagedFds` `resourceLimits`. Missing `markAsUntransferable` `moveMessagePortToContext`.

### [`node:inspector`](https://nodejs.org/api/inspector.html) [#nodeinspector]

🟡 Partially implemented. The `Profiler` API is supported (`Profiler.enable`, `Profiler.disable`, `Profiler.start`, `Profiler.stop`, `Profiler.setSamplingInterval`). Other inspector APIs are not implemented.

### [`node:repl`](https://nodejs.org/api/repl.html) [#noderepl]

🟡 Mostly implemented. `bun --interactive` starts a Node.js-compatible REPL. Result previews (which need V8's inspector-based side-effect-free eval), tab-completion of `let`/`const`/`class` bindings in `useGlobal: true` mode, and some V8-specific error-message wording differ.

### [`node:sqlite`](https://nodejs.org/api/sqlite.html) [#nodesqlite]

🟢 Fully implemented. `backup()` runs synchronously and blocks the event loop for the duration of the copy (Node runs it on a worker thread). A `Buffer`/`Uint8Array` database path must be valid UTF-8 (Node passes the raw bytes through; Bun rejects non-UTF-8 with `ERR_INVALID_ARG_VALUE`). On macOS, Bun uses the system `libsqlite3.dylib`; `loadExtension()` (and, on older macOS releases, `createSession()`/`applyChangeset()`) require a full SQLite build — call `require("bun:sqlite").Database.setCustomSQLite(path)` before opening a database.

### [`node:test`](https://nodejs.org/api/test.html) [#nodetest]

🟡 Partially implemented. The in-process API works when test files run under `bun test`: tests, suites, subtests, hooks, `t.plan()`, `t.assert`, `assert.register()`, `t.waitFor()`, `getTestContext()`, and `t.mock` (function/method/getter/setter/property mocks and mock timers). Missing `run()`, `node:test/reporters`, snapshot testing, `mock.module()`, code coverage, `--test-only`, test-level `signal`/`t.signal` abort, and Node's `--test` CLI runner mode. `test.only()` / `{only: true}` are accepted but do not filter. `concurrency` is validated but subtests always run serially. Use [`bun:test`](/test) instead.

### [`node:trace_events`](https://nodejs.org/api/tracing.html) [#nodetrace_events]

🟢 Fully implemented.

## Node.js globals [#nodejs-globals]

The following list covers every global implemented by Node.js and Bun's compatibility status for each.

### [`AbortController`](https://developer.mozilla.org/en-US/docs/Web/API/AbortController) [#abortcontroller]

🟢 Fully implemented.

### [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) [#abortsignal]

🟢 Fully implemented.

### [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob) [#blob]

🟢 Fully implemented.

### [`Buffer`](https://nodejs.org/api/buffer.html#class-buffer) [#buffer]

🟢 Fully implemented.

### [`ByteLengthQueuingStrategy`](https://developer.mozilla.org/en-US/docs/Web/API/ByteLengthQueuingStrategy) [#bytelengthqueuingstrategy]

🟢 Fully implemented.

### [`__dirname`](https://nodejs.org/api/globals.html#__dirname) [#__dirname]

🟢 Fully implemented.

### [`__filename`](https://nodejs.org/api/globals.html#__filename) [#__filename]

🟢 Fully implemented.

### [`atob()`](https://developer.mozilla.org/en-US/docs/Web/API/atob) [#atob]

🟢 Fully implemented.

### [`Atomics`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Atomics) [#atomics]

🟢 Fully implemented.

### [`BroadcastChannel`](https://developer.mozilla.org/en-US/docs/Web/API/BroadcastChannel) [#broadcastchannel]

🟢 Fully implemented.

### [`btoa()`](https://developer.mozilla.org/en-US/docs/Web/API/btoa) [#btoa]

🟢 Fully implemented.

### [`clearImmediate()`](https://developer.mozilla.org/en-US/docs/Web/API/Window/clearImmediate) [#clearimmediate]

🟢 Fully implemented.

### [`clearInterval()`](https://developer.mozilla.org/en-US/docs/Web/API/Window/clearInterval) [#clearinterval]

🟢 Fully implemented.

### [`clearTimeout()`](https://developer.mozilla.org/en-US/docs/Web/API/Window/clearTimeout) [#cleartimeout]

🟢 Fully implemented.

### [`CompressionStream`](https://developer.mozilla.org/en-US/docs/Web/API/CompressionStream) [#compressionstream]

🟢 Fully implemented.

### [`console`](https://developer.mozilla.org/en-US/docs/Web/API/console) [#console]

🟢 Fully implemented.

### [`CountQueuingStrategy`](https://developer.mozilla.org/en-US/docs/Web/API/CountQueuingStrategy) [#countqueuingstrategy]

🟢 Fully implemented.

### [`Crypto`](https://developer.mozilla.org/en-US/docs/Web/API/Crypto) [#crypto]

🟢 Fully implemented.

### [`SubtleCrypto (crypto)`](https://developer.mozilla.org/en-US/docs/Web/API/crypto) [#subtlecrypto-crypto]

🟢 Fully implemented.

### [`CryptoKey`](https://developer.mozilla.org/en-US/docs/Web/API/CryptoKey) [#cryptokey]

🟢 Fully implemented.

### [`CustomEvent`](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent) [#customevent]

🟢 Fully implemented.

### [`DecompressionStream`](https://developer.mozilla.org/en-US/docs/Web/API/DecompressionStream) [#decompressionstream]

🟢 Fully implemented.

### [`Event`](https://developer.mozilla.org/en-US/docs/Web/API/Event) [#event]

🟢 Fully implemented.

### [`EventTarget`](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget) [#eventtarget]

🟢 Fully implemented.

### [`exports`](https://nodejs.org/api/globals.html#exports) [#exports]

🟢 Fully implemented.

### [`fetch`](https://developer.mozilla.org/en-US/docs/Web/API/fetch) [#fetch]

🟢 Fully implemented.

### [`FormData`](https://developer.mozilla.org/en-US/docs/Web/API/FormData) [#formdata]

🟢 Fully implemented.

### [`global`](https://nodejs.org/api/globals.html#global) [#global]

🟢 Implemented. `global` is an object containing all objects in the global namespace. It's rarely referenced directly, as its contents are available without a prefix, for example `__dirname` instead of `global.__dirname`.

### [`globalThis`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis) [#globalthis]

🟢 Aliases to `global`.

### [`Headers`](https://developer.mozilla.org/en-US/docs/Web/API/Headers) [#headers]

🟢 Fully implemented.

### [`MessageChannel`](https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel) [#messagechannel]

🟢 Fully implemented.

### [`MessageEvent`](https://developer.mozilla.org/en-US/docs/Web/API/MessageEvent) [#messageevent]

🟢 Fully implemented.

### [`MessagePort`](https://developer.mozilla.org/en-US/docs/Web/API/MessagePort) [#messageport]

🟢 Fully implemented.

### [`module`](https://nodejs.org/api/globals.html#module) [#module]

🟢 Fully implemented.

### [`PerformanceEntry`](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceEntry) [#performanceentry]

🟢 Fully implemented.

### [`PerformanceMark`](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceMark) [#performancemark]

🟢 Fully implemented.

### [`PerformanceMeasure`](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceMeasure) [#performancemeasure]

🟢 Fully implemented.

### [`PerformanceObserver`](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceObserver) [#performanceobserver]

🟢 Fully implemented.

### [`PerformanceObserverEntryList`](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceObserverEntryList) [#performanceobserverentrylist]

🟢 Fully implemented.

### [`PerformanceResourceTiming`](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceResourceTiming) [#performanceresourcetiming]

🟢 Fully implemented.

### [`performance`](https://developer.mozilla.org/en-US/docs/Web/API/performance) [#performance]

🟢 Fully implemented.

### [`process`](https://nodejs.org/api/process.html) [#process]

🟡 Mostly implemented. `process.binding` (internal Node.js bindings some packages rely on) is partially implemented. `process.title` is a no-op on macOS & Linux. `getActiveResourcesInfo` `setActiveResourcesInfo`, `getActiveResources` and `setSourceMapsEnabled` are stubs. Newer APIs like `process.loadEnvFile` are not implemented.

### [`queueMicrotask()`](https://developer.mozilla.org/en-US/docs/Web/API/queueMicrotask) [#queuemicrotask]

🟢 Fully implemented.

### [`ReadableByteStreamController`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableByteStreamController) [#readablebytestreamcontroller]

🟢 Fully implemented.

### [`ReadableStream`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream) [#readablestream]

🟢 Fully implemented.

### [`ReadableStreamBYOBReader`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamBYOBReader) [#readablestreambyobreader]

🟢 Fully implemented.

### [`ReadableStreamBYOBRequest`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamBYOBRequest) [#readablestreambyobrequest]

🟢 Fully implemented.

### [`ReadableStreamDefaultController`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamDefaultController) [#readablestreamdefaultcontroller]

🟢 Fully implemented.

### [`ReadableStreamDefaultReader`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamDefaultReader) [#readablestreamdefaultreader]

🟢 Fully implemented.

### [`require()`](https://nodejs.org/api/globals.html#require) [#require]

🟢 Fully implemented, including [`require.main`](https://nodejs.org/api/modules.html#requiremain), [`require.cache`](https://nodejs.org/api/modules.html#requirecache), [`require.resolve`](https://nodejs.org/api/modules.html#requireresolverequest-options).

### [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response) [#response]

🟢 Fully implemented.

### [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Request) [#request]

🟢 Fully implemented.

### [`setImmediate()`](https://developer.mozilla.org/en-US/docs/Web/API/Window/setImmediate) [#setimmediate]

🟢 Fully implemented.

### [`setInterval()`](https://developer.mozilla.org/en-US/docs/Web/API/Window/setInterval) [#setinterval]

🟢 Fully implemented.

### [`setTimeout()`](https://developer.mozilla.org/en-US/docs/Web/API/Window/setTimeout) [#settimeout]

🟢 Fully implemented.

### [`structuredClone()`](https://developer.mozilla.org/en-US/docs/Web/API/structuredClone) [#structuredclone]

🟢 Fully implemented.

### [`SubtleCrypto`](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) [#subtlecrypto]

🟢 Fully implemented.

### [`DOMException`](https://developer.mozilla.org/en-US/docs/Web/API/DOMException) [#domexception]

🟢 Fully implemented.

### [`TextDecoder`](https://developer.mozilla.org/en-US/docs/Web/API/TextDecoder) [#textdecoder]

🟢 Fully implemented.

### [`TextDecoderStream`](https://developer.mozilla.org/en-US/docs/Web/API/TextDecoderStream) [#textdecoderstream]

🟢 Fully implemented.

### [`TextEncoder`](https://developer.mozilla.org/en-US/docs/Web/API/TextEncoder) [#textencoder]

🟢 Fully implemented.

### [`TextEncoderStream`](https://developer.mozilla.org/en-US/docs/Web/API/TextEncoderStream) [#textencoderstream]

🟢 Fully implemented.

### [`TransformStream`](https://developer.mozilla.org/en-US/docs/Web/API/TransformStream) [#transformstream]

🟢 Fully implemented.

### [`TransformStreamDefaultController`](https://developer.mozilla.org/en-US/docs/Web/API/TransformStreamDefaultController) [#transformstreamdefaultcontroller]

🟢 Fully implemented.

### [`URL`](https://developer.mozilla.org/en-US/docs/Web/API/URL) [#url]

🟢 Fully implemented.

### [`URLSearchParams`](https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams) [#urlsearchparams]

🟢 Fully implemented.

### [`WebAssembly`](https://nodejs.org/api/globals.html#webassembly) [#webassembly]

🟢 Fully implemented.

### [`WritableStream`](https://developer.mozilla.org/en-US/docs/Web/API/WritableStream) [#writablestream]

🟢 Fully implemented.

### [`WritableStreamDefaultController`](https://developer.mozilla.org/en-US/docs/Web/API/WritableStreamDefaultController) [#writablestreamdefaultcontroller]

🟢 Fully implemented.

### [`WritableStreamDefaultWriter`](https://developer.mozilla.org/en-US/docs/Web/API/WritableStreamDefaultWriter) [#writablestreamdefaultwriter]

🟢 Fully implemented.
