The goal of this documentation is to comprehensively explain the Node.jsAPI, both from a reference as well as a conceptual point of view. Eachsection describes a built-in module or high-level concept.
Where appropriate, property types, method arguments, and the argumentsprovided to event handlers are detailed in a list underneath the topicheading.
If errors are found in this documentation, pleasesubmit an issueor seethe contributing guide for directions on how to submit a patch.
Every file is generated based on the corresponding.md
file in thedoc/api/
folder in Node.js's source tree. The documentation is generatedusing thetools/doc/generate.js
program. An HTML template is located atdoc/template.html
.
Throughout the documentation are indications of a section'sstability. The Node.js API is still somewhat changing, and as itmatures, certain parts are more reliable than others. Some are soproven, and so relied upon, that they are unlikely to ever change atall. Others are brand new and experimental, or known to be hazardousand in the process of being redesigned.
The stability indices are as follows:
Note: Caution must be used when making use ofExperimental
features,particularly within modules that may be used as dependencies (or dependenciesof dependencies) within a Node.js application. End users may not be aware thatexperimental features are being used, and therefore may experience unexpectedfailures or behavior changes when API modifications occur. To help avoid suchsurprises,Experimental
features may require a command-line flag toexplicitly enable them, or may cause a process warning to be emitted.By default, such warnings are printed tostderr
and may be handled byattaching a listener to theprocess.on('warning')
event.
Every.html
document has a corresponding.json
document presentingthe same information in a structured manner. This feature isexperimental, and added for the benefit of IDEs and other utilities thatwish to do programmatic things with the documentation.
System calls likeopen(2) andread(2) define the interface between user programsand the underlying operating system. Node functions which simply wrap a syscall,likefs.open()
, will document that. The docs link to the corresponding manpages (short for manual pages) which describe how the syscalls work.
Some syscalls, likelchown(2), are BSD-specific. That means, forexample, thatfs.lchown()
only works on macOS and other BSD-derived systems,and is not available on Linux.
Most Unix syscalls have Windows equivalents, but behavior may differ on Windowsrelative to Linux and macOS. For an example of the subtle ways in which it'ssometimes impossible to replace Unix syscall semantics on Windows, seeNode.jsissue 4760.