Expand description
Node.js core modules implemented natively for node-js.
A require(spec) (see builtins::call_builtin_function) resolves a supported
module to a JsObj::Builtin("<module>") namespace value — exactly the shape
of the built-in console/Math namespaces — so mod.method(...) dispatches
through host::call_method → builtins::call_builtin_function("<module>.<method>")
→ stdlib::call, and const { method } = require('mod') reads the method as a
first-class Builtin("mod.method") via namespace_property.
Every stdlib function is free-standing and acquires the thread-local JsHost
through with_host only around allocations (and releases it before any
re-entrant host::invoke), so callbacks (fs async, EventEmitter.emit,
assert.throws) never double-borrow the host. Stateful instances (Buffer,
crypto Hash, EventEmitter, URL) are plain objects carrying a hidden
@@native tag (filtered from enumeration/display like @@iterator); their
methods route through instance_call from host::call_method.
Modules§
- assert
- Node
assertmodule. Failing assertions throw anAssertionError(returned as anErr, which the host surfaces as a thrown JS exception). - assert_
diff - The structural diff Node prints inside an
AssertionErrormessage. - async_
hooks - Node
async_hooksmodule — honest minimal implementation. - buffer
- Node
Buffer(global +require('buffer').Buffer). A Buffer is a plain object tagged@@native = "Buffer"whose bytes live in a hidden@@bytesarray SHARED with itsArrayBuffer(@@buffer, read asbuf.buffer); the Buffer is a window (byteOffset/length) onto it, so every reader goes throughwindow_bytes_h. - child_
process - Node
child_processmodule — real subprocess execution viastd::process::Command. - cluster
- Node
cluster— real process-fork model overstd::process::Command. - console
- Node
consolemodule (require('console')), sharing the exact rendering the globalconsole.*uses: every argument is run throughJsHost::console_format(strings verbatim, everything else viautil.inspect) and space-joined — the same pipelinebuiltins::print_linedrives — so module output is identical to the global.log/info/debuggo to stdout;error/warn/trace/assertto stderr.count,groupandtimekeep per-thread state here (a monotonicInstantbacks the timers, sotimeEndreports a real elapsed duration). - constants
- The platform’s errno, signal and filesystem constants.
- crypto
- Node
cryptomodule. - date
- JavaScript
Date(global constructor). A Date is a plain object tagged@@native = "Date"whose time value (milliseconds since the Unix epoch, or NaN for an invalid date) lives in a hidden@@msfield. - dgram
- Node
dgrammodule: real UDP sockets overstd::net::UdpSocket. - diagnostics_
channel - Node
diagnostics_channel— in-process publish/subscribe named channels. - dns
- Node
dnsmodule. - domain
- Node
domainmodule (deprecated in Node, implemented here with its real error-trapping semantics). ADomainis an EventEmitter (same@@native+@@on/@@onceshape asevents/net) whose defining behaviour isdomain.run(fn): it runsfnand, iffnthrows, emits the domain’s'error'event with the thrown value instead of propagating the throw. - event_
target - The WHATWG
Event/EventTarget/CustomEventglobals — a port of node’slib/internal/event_target.js, restricted to what a non-DOM target can observe (there is no tree, so there is no capture or bubble PATH: every dispatch runs at the target,eventPhaseisAT_TARGETwhile listeners run andcomposedPath()is[target]). - events
- Node
eventsmodule:EventEmitter. The emitter is an object tagged@@native = "EventEmitter"with a hidden@@onmap (event name → the ordered RAW listener array: aonceregistration is stored as node’s_onceWrapwrapper, whose.listeneris the function registered).emitcollects listeners, releases the host borrow, then invokes each so callbacks can re-enter the host. - fetch
- The WHATWG Fetch globals:
fetch,Headers,Request,Response,Blob,FormData,AbortControllerandAbortSignal. - fs
- Node
fsmodule: synchronous file operations, the async callback forms, and the file-descriptor / directory / stream / watcher surfaces. - fs_
promises - Node
fs/promises(alsorequire('fs').promises) — Promise-returning file operations. - http
- Node
httpmodule: an HTTP/1.1 server built on top ofnet. - http2
- Node
http2module: a REAL, minimal HTTP/2 server over TLS+ALPN. - https
- Node
httpsmodule: HTTP/1.1 over real TLS. - iterator
- Iterator helpers (27.1.4) —
map,filter,take,drop,flatMapand the terminalreduce/toArray/forEach/some/every/find, plus theIteratorconstructor,Iterator.fromandIterator.concat. - net
- Node
netmodule: TCPServerandSocket. - node_
module - Node
modulecore module —require('module')(a.k.a.require('node:module')). - os
- Node
osmodule. Values that Node derives from the host (platform, arch, hostname, home/tmp dirs, endianness, EOL) are returned faithfully; the machine-specific numeric readings (cpus,totalmem,freemem,loadavg,uptime) return best-effort placeholders (not fuzzed — they vary per host on reference Node too). - path
- Node
pathmodule — both flavors. - perf_
hooks - Node
perf_hooksmodule. - process
- Node
processglobal — the subset packages read at load time. - punycode
- Node
punycodemodule — a faithful implementation of the RFC 3492 Bootstring algorithm with the Punycode parameter set. The module is deprecated in Node but still present; the codec is pure and deterministic (no host state beyond allocating the returned string/array), so it round-trips independently of any network or locale. - querystring
- Node
querystringmodule, a port oflib/querystring.js:parse/stringify(and theirdecode/encodealiases, which are the same functions),escape,unescapeandunescapeBuffer. The legacyapplication/x-www-form-urlencodedrules, with+standing for a space — distinct from theqspackage express also ships. - readline
- Node
readlinemodule. - repl
- Node
replmodule —repl.start([options]). - stream
- Node
streammodule: native base classes + module helper functions. - stream_
consumers - Node
stream/consumersmodule: read an entire stream to a single value. - stream_
promises - Node
stream/promisesmodule: the Promise-basedfinishedandpipeline. - stream_
web - Node
stream/webmodule: the WHATWG Streams API. - string_
decoder - Node
string_decodercore module:new StringDecoder(encoding)with.write(buffer)/.end([buffer]). A StringDecoder turns byte chunks into a string, holding back an incomplete trailing multibyte sequence until the next chunk completes it. - timers
- Node
timersandtimers/promisesmodules. - tls
- Node
tlsmodule: real TLS over blockingrustls(rustls::StreamOwnedwrapping astd::net::TcpStream). - trace_
events - Node
trace_eventsmodule. - tty
- Node
ttymodule. - typedarray
- JavaScript typed arrays (
Uint8Array/Int8Array/…/Float64Array),ArrayBuffer,WeakRef, andTextEncoder/TextDecoder. - url
- Node
urlmodule: the WHATWGURLclass (global +require('url').URL) and the legacyurl.parse. Parsing and the component setters are the URL Standard’s, through theurlcrate (its basic URL parser andquirkssetters). AURLinstance keeps each component in a hidden@@<name>slot read by the accessors onURL.prototype; a setter rewrites every slot from the re-serialized URL (set_component), and thesearchParamsit carries holds an@@ownerUrlback-reference so its own mutations rewrite the query in the other direction. - url_
legacy - The legacy
url.parse/url.formatAPI — a faithful port of Node’slib/url.jsUrl.prototype.parse,Url.prototype.formatandurlFormat. - util
- Node
utilmodule:format,inspect, and a subset ofutil.types. - util_
types - Node
util.types— runtime type-tag predicates. - v8
- Node
v8module — a compatibility shim, NOT real V8 introspection. - vm
- Node
vmmodule — code compilation and evaluation reusing node-js’s own engine. - worker_
threads - Node
worker_threads: real OS-thread workers with fully isolated heaps. - zlib
- Node
zlibmodule — real DEFLATE / zlib / gzip / brotli / zstd + CRC-32.
Constants§
- SUBTLE_
CRYPTO_ CLASS - The key of the
SubtleCryptoCLASS.SubtleCryptoitself names thecrypto.subtlenamespace, and the last dotted segment is the name the class reports. - UNIMPLEMENTED_
MODULES - Native-heavy core modules that node-js does not yet implement (TLS handshakes,
HTTP/2 framing, OS worker threads sharing the thread-local heap, UDP sockets,
V8 inspector, etc.).
requireing them succeeds and yields a namespace so that programs which import-then-conditionally-use them still load; ACTUALLY calling a method throwsError: <mod>.<method> is not implemented in node-js. This is an honest not-yet-built surface, never a silent fake.
Functions§
- brand_
checked_ class - The web classes whose prototype getters brand-check
thisand throwERR_INVALID_THISfor any other receiver. - call
- Dispatch a resolved stdlib builtin (
assert, ornamespace.method). ReturnsNoneifnameis not a stdlib builtin (the caller falls through to the core builtin table). - class_
display_ name - The display name of a class key (
webcrypto.SubtleCrypto→SubtleCrypto). - constant
- A non-function constant on a stdlib namespace (
path.sep,os.EOL,buffer.Buffer,url.URL), reachable vianamespace_property. - construct
- Construct a stdlib class instance (
new URL(...),new EventEmitter(), andnew Buffer(...)legacy), reachable fromconstruct_builtin.Noneifnameis not a stdlib constructor. - core_
keys - node’s
Object.keys(require(id))for the core module spelledns. - data_
module - Canonical namespace name a
require(spec)resolves to (after stripping an optionalnode:prefix), orNonefor an unsupported module. Core modules whose export is a plain DATA value rather than a namespace of methods.require('constants')is the only one: every member is a number, so it is built as a real object instead of aBuiltinhandle, whose members are dispatchable methods by construction. - has_
to_ json - Native instance tags whose
instance_callimplementstoJSON(), whichJSON.stringifymust invoke before serializing the value. (instance_has_methodonly covers tags with a declared method table;Datedispatches directly.) - illegal_
constructor new Performance(),new Crypto(), … — classes node lets no script build.- instance_
accessor_ written - instance_
accessors - instance_
call - Dispatch a method call on a native stdlib instance (
recvcarries a@@nativetag). Called fromhost::call_methodbefore the generic object method resolution. - instance_
has_ method - Whether
nameis a method of a native instance taggedtag. Used byget_propertyso a method read (server.listen.apply(...), the express listen path) yields a bound method rather thanundefined— the method is still dispatched throughinstance_callwhen the bound method is invoked. - instance_
inspect_ is_ custom - Whether node gives instances of
taga CUSTOMutil.inspect— one that prints a curated view and nothing else. Such a class hides a subclass’s own properties and the[Tag]suffix:class S extends AbortController {}isS { signal: … }, and anEventTargetsubclass prints{}even with own fields. - instance_
inspect_ members - How
util.inspectrenders an instance oftag, as(accessors to show, whether to print the class name). - instance_
late_ methods - The ACCESSOR properties a native class’s prototype carries, as
(name, has_setter), and theSymbol.toStringTagit stamps (empty for none). - instance_
members_ enumerable - instance_
method_ lists - is_core
- Whether
specnames a core module of any kind — a method namespace or a data module. This is whatrequire.resolveanswers with the bare specifier. - is_
method - True if
qualified(namespace.method) is a stdlib method thatcall_builtin_functionshould route intocall(extendsis_known_builtin). - is_
unimplemented - True if
nsis a known-but-unimplemented core module (seeUNIMPLEMENTED_MODULES). - namespace_
ctors - Class/constructor members a namespace re-exports as values rather than
callable methods (
require('buffer').Buffer,require('url').URL). They are enumerable own keys too, sofor (k in buffer)seesBuffer. - namespace_
keys - namespace_
methods - The callable members of builtin namespace
ns. THE single table backing bothis_method(doesns.mdispatch?) andnamespace_keys(what doesfor (k in ns)yield?), so a method can never be callable-but-unenumerable or the reverse. - namespace_
statics_ enumerable - The enumerable own keys of the builtin namespace
ns— whatfor (key in ns)andObject.keys(ns)yield. These are the members node-js ACTUALLY implements, not Node’s full export list, so a package that copies a namespace key-by-key (safer-buffer clonesbufferandBuffer) ends up with exactly the working set rather than an empty object. Whether a stdlib namespace’s statics are ENUMERABLE own properties. A core module’s exports and a node or WebIDL class’s statics (Buffer.from,URL.canParse) are; an ECMAScript intrinsic constructor’s are not (Iterator.from,Iterator.concat). - namespace_
values - Non-callable members a namespace exports as enumerable VALUES — the nested
modules and cross-links (
timers.promises,assert.strict,path.posix,crypto.subtle). Listed apart fromnamespace_ctorsbecause they are values rather than constructors; likefs.promisesamong the ctors, each read resolves throughconstantbefore any method thunk is considered. - native_
parent - The method names a native instance tagged
tagcarries, as(its own list, the EventEmitter surface it also gets or empty). - native_
tag - The hidden
@@nativeinstance tag ofrecv("Buffer"/"Hash"/"EventEmitter"/"URL"), orNonefor a non-native object. - resolve
- singleton_
class - A builtin SINGLETON kept as a namespace (
performance,crypto,crypto.subtle) and the class it is the one instance of, under the key that class’sBuiltinis spelled with. Every view of the instance — its prototype,instanceof, brand,constructor, own keys,hasOwnProperty, and its methods (read off the class prototype) — consults this one table.