Core modules
These modules are fully or substantially implemented and available with thenodejs_compat compatibility flag.
assert
node:assert/strict are available.
Status: Fully functional
async_hooks
AsyncLocalStorage for context management across asynchronous operations. Can be enabled independently via the nodejs_als compatibility flag.
Key APIs:
AsyncLocalStorageAsyncResource
buffer
Buffer class for binary data manipulation. Implemented in C++ for performance.
Key APIs:
Bufferclass with all standard methodsSlowBuffer- Constants:
INSPECT_MAX_BYTES,kMaxLength,kStringMaxLength
src/workerd/api/node/buffer.{h,c++}
crypto
createHash(),createHmac()createSign(),createVerify()createCipheriv(),createDecipheriv()generateKeyPair(),generateKeyPairSync()randomBytes(),randomFill(),randomInt(),randomUUID()pbkdf2(),scrypt(),hkdf()getCiphers(),getHashes(),getCurves()- Key objects:
KeyObject,CryptoKey
src/workerd/api/node/crypto.{h,c++}
diagnostics_channel
channel(name)hasSubscribers(name)subscribe(name, callback)unsubscribe(name, callback)Channelclass
src/workerd/api/node/diagnostics-channel.{h,c++}
events
EventEmitter class for event-driven programming.
Status: Fully functional
path
basename(),dirname(),extname()join(),resolve(),relative()normalize(),isAbsolute()parse(),format()- Platform-specific:
path.posix,path.win32
process
process.env(withnodejs_compat_populate_process_envflag)process.nextTick()process.version,process.versionsprocess.platform,process.arch- Event emitter methods
src/workerd/api/node/process.{h,c++}
stream
Readable,Writable,Duplex,Transform,PassThroughpipeline(),finished()- Submodules:
stream/consumers,stream/promises,stream/web
string_decoder
timers
node:timers/promises for promise-based APIs.
Status: Fully functional
Location: src/workerd/api/node/timers.{h,c++}
url
ada-url library for WHATWG URL compliance.
Key APIs:
URL,URLSearchParamsclassesparse(),format(),resolve()fileURLToPath(),pathToFileURL()
src/workerd/api/node/url.{h,c++}
util
promisify(),callbackify()inspect()format(),formatWithOptions()typesobject with type checking utilitiesTextEncoder,TextDecoderisDeepStrictEqual()
src/workerd/api/node/util.{h,c++}
zlib
gzip(),gunzip(),gzipSync(),gunzipSync()deflate(),inflate(),deflateSync(),inflateSync()brotliCompress(),brotliDecompress()createGzip(),createGunzip(),createDeflate(),createInflate()- Constants and options for compression
nodejs_zlib flag)
Location: src/workerd/api/node/zlib-util.{h,c++}
Network modules
These modules require additional compatibility flags and have limitations compared to Node.js.dns
RUST_BACKED_NODE_DNS autogate.
Status: Partially implemented
Location: src/workerd/api/node/dns.{h,c++}
http
enable_nodejs_http_modules flag.
Key APIs:
request(),get()- Internal modules:
_http_agent,_http_client,_http_common,_http_incoming,_http_outgoing
https
enable_nodejs_http_modules flag.
Status: Partially implemented (client only)
http2
enable_nodejs_http2_module flag.
Status: Partially implemented
net
tls
_tls_common and _tls_wrap.
Status: Partially implemented
Filesystem
fs
enable_nodejs_fs_module flag.
Status: Partially implemented (limited filesystem access in Workers environment)
System information
os
enable_nodejs_os_module flag.
Status: Partially implemented (some values may be stubs)
Advanced modules
module
src/workerd/api/node/module.{h,c++}
querystring
sqlite
enable_nodejs_sqlite_module flag.
Status: Functional (experimental)
Location: src/workerd/api/node/sqlite.{h,c++}
test
Non-functional stub modules
These modules are provided as non-functional stubs to prevent import errors when running code designed for Node.js. They require specific compatibility flags and throw errors when used.Stub modules list
Stub modules list
The following modules are non-functional stubs:
node:child_process(requiresenable_nodejs_child_process_module)node:cluster(requiresenable_nodejs_cluster_module)node:console(requiresenable_nodejs_console_module)node:dgram(requiresenable_nodejs_dgram_module)node:domain(requiresenable_nodejs_domain_module)node:inspector(requiresenable_nodejs_inspector_module)node:perf_hooks(requiresenable_nodejs_perf_hooks_module)node:punycode(requiresenable_nodejs_punycode_module)node:readline(requiresenable_nodejs_readline_module)node:repl(requiresenable_nodejs_repl_module)node:trace_events(requiresenable_nodejs_trace_events_module)node:tty(requiresenable_nodejs_tty_module)node:v8(requiresenable_nodejs_v8_module)node:vm(requiresenable_nodejs_vm_module)node:wasi(requiresenable_nodejs_wasi_module)node:worker_threads(requiresenable_nodejs_worker_threads_module)node:_stream_wrap(requiresenable_nodejs_stream_wrap_module)
Implementation locations
Node.js compatibility is implemented across two directories:- C++ layer:
src/workerd/api/node/- Native implementations registered viaNODEJS_MODULESmacro innode.h - TypeScript layer:
src/node/- Publicnode:*modules that import fromnode-internal:*specifiers