History Introduced in: v0.10.0
v0.10.0
Welcome to the official API reference documentation for Node.js!
Node.js is a JavaScript runtime built on the V8 JavaScript engine .
Report errors in this documentation in the issue tracker . See
the contributing guide for directions on how to submit pull requests.
Throughout the documentation are indications of a section's stability. Some APIs
are so proven and so relied upon that they are unlikely to ever change at all.
Others are brand new and experimental, or known to be hazardous.
The stability indexes are as follows:
Stability: 0 Deprecated. The feature may emit warnings. Backward
compatibility is not guaranteed.
Stability: 1 Experimental. The feature is not subject to
semantic versioning rules. Non-backward compatible changes or removal may
occur in any future release. Use of the feature is not recommended in
production environments.
Stability: 2 Stable. Compatibility with the npm ecosystem is a high
priority.
Stability: 3 Legacy. Although this feature is unlikely to be removed and is
still covered by semantic versioning guarantees, it is no longer actively
maintained, and other alternatives are available.
Features are marked as legacy rather than being deprecated if their use does no
harm, and they are widely relied upon within the npm ecosystem. Bugs found in
legacy features are unlikely to be fixed.
Use caution when making use of Experimental features, particularly when
authoring libraries. Users may not be aware that experimental features are being
used. Bugs or behavior changes may surprise users when Experimental API
modifications occur. To avoid surprises, use of an Experimental feature may need
a command-line flag. Experimental features may also emit a warning .
Assert Stable The `node:assert` module provides a set of assertion functions for verifying invariants. Async hooks Experimental We strongly discourage the use of the `async_hooks` API. Other APIs that can cover most of its use cases include: Asynchronous context tracking Stable Buffer Stable `Buffer` objects are used to represent a fixed-length sequence of bytes. Many Node.js APIs support `Buffer`s. Child process Stable The `node:child_process` module provides the ability to spawn subprocesses in a manner that is similar, but not identical, to `popen(3)`. This capability is primarily provided by the `child_process.spawn()` function: Cluster Stable Clusters of Node.js processes can be used to run multiple instances of Node.js that can distribute workloads among their application threads. When process isolation is not needed, use the `worker_threads` module instead, which allows running multiple application threads within a single Node.js instance. Console Stable The `node:console` module provides a simple debugging console that is similar to the JavaScript console mechanism provided by web browsers. Crypto Stable The `node:crypto` module provides cryptographic functionality that includes a set of wrappers for OpenSSL's hash, HMAC, cipher, decipher, sign, and verify functions. Debugger Stable Node.js includes a command-line debugging utility. The Node.js debugger client is not a full-featured debugger, but simple stepping and inspection are possible. Diagnostic report Stable Delivers a JSON-formatted diagnostic summary, written to a file. Diagnostics Channel Stable The `node:diagnostics_channel` module provides an API to create named channels to report arbitrary message data for diagnostics purposes. DNS Stable The `node:dns` module enables name resolution. For example, use it to look up IP addresses of host names. Domain Deprecated **This module is pending deprecation.** Once a replacement API has been finalized, this module will be fully deprecated. Most developers should **not** have cause to use this module. Users who absolutely must have the functionality that domains provide may rely on it for the time being but should expect to have to migrate to a different solution in the future. Events Stable Much of the Node.js core API is built around an idiomatic asynchronous event-driven architecture in which certain kinds of objects (called "emitters") emit named events that cause `Function` objects ("listeners") to be called. FFI Experimental The `node:ffi` module provides an experimental foreign function interface for loading dynamic libraries and calling native symbols from JavaScript. File system Stable The `node:fs` module enables interacting with the file system in a way modeled on standard POSIX functions. Global objects Stable These objects are available in all modules. HTTP Stable This module, containing both a client and server, can be imported via `require('node:http')` (CommonJS) or `import * as http from 'node:http'` (ES module). HTTP/2 Stable The `node:http2` module provides an implementation of the HTTP/2 protocol. It can be accessed using: HTTPS Stable HTTPS is the HTTP protocol over TLS/SSL. In Node.js this is implemented as a separate module. Inspector Stable The `node:inspector` module provides an API for interacting with the V8 inspector. Iterable Streams Experimental The `node:stream/iter` module provides a streaming API built on iterables rather than the event-driven `Readable`/`Writable`/`Transform` class hierarchy, or the Web Streams `ReadableStream`/`WritableStream`/`TransformStream` interfaces. Modules: CommonJS modules Stable CommonJS modules are the original way to package JavaScript code for Node.js. Node.js also supports the ECMAScript modules standard used by browsers and other JavaScript runtimes. Modules: ECMAScript modules Stable Modules: TypeScript Stable Net Stable The `node:net` module provides an asynchronous network API for creating stream-based TCP or IPC servers (`net.createServer()`) and clients (`net.createConnection()`). Node-API Stable Node-API (formerly N-API) is an API for building native Addons. It is independent from the underlying JavaScript runtime (for example, V8) and is maintained as part of Node.js itself. This API will be Application Binary Interface (ABI) stable across versions of Node.js. It is intended to insulate addons from changes in the underlying JavaScript engine and allow modules compiled for one major version to run on later major versions of Node.js without recompilation. The ABI Stability guide provides a more in-depth explanation. OS Stable The `node:os` module provides operating system-related utility methods and properties. It can be accessed using: Path Stable The `node:path` module provides utilities for working with file and directory paths. It can be accessed using: Performance measurement APIs Stable This module provides an implementation of a subset of the W3C Web Performance APIs as well as additional APIs for Node.js-specific performance measurements. Punycode Deprecated **The version of the punycode module bundled in Node.js is being deprecated.** In a future major version of Node.js this module will be removed. Users currently depending on the `punycode` module should switch to using the userland-provided Punycode.js module instead. For punycode-based URL encoding, see `url.domainToASCII` or, more generally, the WHATWG URL API. Query string Stable The `node:querystring` module provides utilities for parsing and formatting URL query strings. It can be accessed using: Readline Stable The `node:readline` module provides an interface for reading data from a Readable stream (such as `process.stdin`) one line at a time. REPL Stable The `node:repl` module provides a Read-Eval-Print-Loop (REPL) implementation that is available both as a standalone program or includible in other applications. It can be accessed using: Single executable applications Experimental This feature allows the distribution of a Node.js application conveniently to a system that does not have Node.js installed. SQLite Experimental The `node:sqlite` module facilitates working with SQLite databases. To access it: Stream Stable A stream is an abstract interface for working with streaming data in Node.js. The `node:stream` module provides an API for implementing the stream interface. String decoder Stable The `node:string_decoder` module provides an API for decoding `Buffer` objects into strings in a manner that preserves encoded multi-byte UTF-8 and UTF-16 characters. It can be accessed using: Test runner Stable The `node:test` module facilitates the creation of JavaScript tests. To access it: Timers Stable The `timer` module exposes a global API for scheduling functions to be called at some future period of time. Because the timer functions are globals, there is no need to call `require('node:timers')` to use the API. TLS (SSL) Stable The `node:tls` module provides an implementation of the Transport Layer Security (TLS) and Secure Socket Layer (SSL) protocols that is built on top of OpenSSL. The module can be accessed using: Trace events Experimental The `node:trace_events` module provides a mechanism to centralize tracing information generated by V8, Node.js core, and userspace code. TTY Stable The `node:tty` module provides the `tty.ReadStream` and `tty.WriteStream` classes. In most cases, it will not be necessary or possible to use this module directly. However, it can be accessed using: UDP/datagram sockets Stable The `node:dgram` module provides an implementation of UDP datagram sockets. URL Stable The `node:url` module provides utilities for URL resolution and parsing. It can be accessed using: Util Stable The `node:util` module supports the needs of Node.js internal APIs. Many of the utilities are useful for application and module developers as well. To access it: Virtual File System Experimental The `node:vfs` module provides a virtual file system with a `node:fs`-like API. It is useful for tests, fixtures, embedded assets, and other scenarios where you need a self-contained file system without touching the actual file-system. VM (executing JavaScript) Stable The `node:vm` module enables compiling and running code within V8 Virtual Machine contexts. Web Crypto API Stable Node.js provides an implementation of the Web Crypto API standard. Web Streams API Stable An implementation of the WHATWG Streams Standard. WebAssembly System Interface (WASI) Experimental <strong class="critical">The `node:wasi` module does not currently provide the comprehensive file system security properties provided by some WASI runtimes. Full support for secure file system sandboxing may or may not be implemented in future. In the mean time, do not rely on it to run untrusted code. </strong> Worker threads Stable The `node:worker_threads` module enables the use of threads that execute JavaScript in parallel. To access it: Zlib Stable The `node:zlib` module provides compression functionality implemented using Gzip, Deflate/Inflate, Brotli, and Zstd.
Every .html document has a corresponding .json document. This is for IDEs
and other utilities that consume the documentation.
Node.js functions which wrap a system call will document that. The docs link
to the corresponding man pages which describe how the system call works.
Most Unix system calls have Windows analogues. Still, behavior differences may
be unavoidable.