Skip to content
Run BunYour friendly Bun playground
Canary build: these docs may describe unreleased changes. Read this page on docs.runbun.dev

Node built-ins

Built-ins import with or without the node: prefix. Labels are explained on the overview.

ModuleStatusNotes
assert, assert/strictPartialCommon assertions (strictEqual, deepStrictEqual, rejects, …).
async_hooksPartialAsyncLocalStorage keeps its store only synchronously; it’s lost across await and timers. createHook does nothing.
bufferWorksIncludes Blob, File, atob, btoa, isUtf8, isAscii.
child_processStubNo processes in the browser.
clusterStubisPrimary is true; fork throws.
consolePartialThe global console. No Console class.
constantsStubEmpty object.
cryptoPartialcreateHash/createHmac (md5, ripemd160, sha1, sha2, sha3, blake2), hash, pbkdf2, scrypt (sync and callback), randomBytes, randomUUID, randomInt, getRandomValues, timingSafeEqual, webcrypto/subtle. No ciphers, sign/verify, KeyObject, generateKey*.
dgramMissing
diagnostics_channelStubSubscribers never receive messages.
dns, dns/promisesPartiallookup resolves only localhost.
domainMissing
eventsWorksEventEmitter, once, on, with AbortSignal.
fs, fs/promisesPartialSync, callback and promise APIs over the project’s files: read/write/append, stat, readdir (with Dirent), mkdir, rm, rename, copyFile, cp, file descriptors, FileHandle, read/write streams. watch (also recursive) and watchFile fire on changes. No symlinks or hard links; chmod/chown do nothing; fs/promises watch never yields.
httpPartialcreateServer().listen() serves the preview: streamed responses, cookies, WebSocket upgrade. http.request/http.get throw; use fetch.
httpsPartialLike http; no TLS.
http2Stub
inspectorStub
modulePartialbuiltinModules, isBuiltin. createRequire serves built-ins, and its require.resolve finds installed packages and files with Bun’s resolver, computed specifiers too; package requires in ES modules work for string literals (see Toolchain).
netStubisIP* works; no sockets.
osPartialFixed values: Linux, x64, /home/user, /tmp. cpus() and networkInterfaces() are empty.
path, path/posixWorksPOSIX only. path.win32 behaves like POSIX; path/win32 is missing.
perf_hooksPartialperformance, PerformanceObserver. monitorEventLoopDelay reports zeros.
processPartialReports Linux x64 and Node v24.3.0. env, cwd, chdir, nextTick, hrtime, memoryUsage, uptime. stdout/stderr go to the console. argv is ["bun", entry]; stdin never emits; exit and kill throw.
punycodeWorks
querystringWorks
readline, readline/promisesStub
replMissing
sqliteMissingUse bun:sqlite.
stream, stream/promisesWorksBased on readable-stream. Readable.toWeb/fromWeb are basic.
stream/webWorksThe browser’s web stream classes.
string_decoderWorks
sysPartialSame as util.
testMissingUse bun:test.
timers, timers/promisesWorksref, unref, refresh, promise timers with AbortSignal.
tlsStub
trace_eventsMissing
ttyPartialisatty returns false.
urlWorksURL, URLSearchParams, fileURLToPath, pathToFileURL, parse.
util, util/typesPartialformat, inspect, promisify, callbackify, inherits, deprecate, types, isDeepStrictEqual, parseEnv, parseArgs, styleText (no colors). No MIMEType; debuglog does nothing.
v8Stub
vmStub
wasiMissing
worker_threadsPartialisMainThread, MessageChannel, BroadcastChannel. new Worker() throws.
zlibPartialgzip, deflate (zlib and raw) and unzip: sync, callback and stream APIs, crc32, constants. Brotli functions throw.

Try a few of them:

index.ts
import { EventEmitter, once } from "node:events";
import { mkdir, readdir, readFile, writeFile } from "node:fs/promises";
import { join } from "node:path";
import { createHash, randomUUID } from "node:crypto";
import { gunzipSync, gzipSync } from "node:zlib";
import { format } from "node:util";

await mkdir("data", { recursive: true });
await writeFile(join("data", "hello.txt"), "hi from node:fs");
console.log(await readdir("data"), await readFile("data/hello.txt", "utf8"));

console.log(createHash("sha1").update("bun").digest("hex"), randomUUID().length);
console.log(gunzipSync(gzipSync(Buffer.from("zlib round trip"))).toString());

const emitter = new EventEmitter();
setTimeout(() => emitter.emit("ready", 42), 10);
const [value] = await once(emitter, "ready");
console.log(format("event said %d", value));