Skip to main content

Node APIs reference

Every Node.js built-in module supported by Deno and its exports. Use your browser's find-in-page to locate a symbol, then click through for full documentation.

node:assert

  • c
    assert.AssertionError

    Indicates the failure of an assertion. All errors thrown by the node:assert module will be instances of the AssertionError class.

  • c
    assert.CallTracker

    This feature is deprecated and will be removed in a future version. Please consider using alternatives such as the mock helper function.

  • f
    N
    assert

    An alias of ok.

  • f
    assert.deepEqual

    Strict assertion mode

  • f
    assert.deepStrictEqual

    Tests for deep equality between the actual and expected parameters. "Deep" equality means that the enumerable "own" properties of child objects are recursively evaluated also by the following rules.

  • f
    assert.doesNotMatch

    Expects the string input not to match the regular expression.

  • f
    assert.doesNotReject

    Awaits the asyncFn promise or, if asyncFn is a function, immediately calls the function and awaits the returned promise to complete. It will then check that the promise is not rejected.

  • f
    assert.doesNotThrow

    Asserts that the function fn does not throw an error.

  • f
    assert.equal

    Strict assertion mode

  • f
    assert.fail

    Throws an AssertionError with the provided error message or a default error message. If the message parameter is an instance of an Error then it will be thrown instead of the AssertionError.

  • f
    assert.ifError

    Throws value if value is not undefined or null. This is useful when testing the error argument in callbacks. The stack trace contains all frames from the error passed to ifError() including the potential new frames for ifError() itself.

  • f
    assert.match

    Expects the string input to match the regular expression.

  • f
    assert.notDeepEqual

    Strict assertion mode

  • f
    assert.notDeepStrictEqual

    Tests for deep strict inequality. Opposite of deepStrictEqual.

  • f
    assert.notEqual

    Strict assertion mode

  • f
    assert.notStrictEqual

    Tests strict inequality between the actual and expected parameters as determined by Object.is().

  • f
    assert.ok

    Tests if value is truthy. It is equivalent to assert.equal(!!value, true, message).

  • f
    assert.partialDeepStrictEqual

    assert.partialDeepStrictEqual() Asserts the equivalence between the actual and expected parameters through a deep comparison, ensuring that all properties in the expected parameter are present in the actual parameter with equivalent values, not allowing type coercion. The main difference with assert.deepStrictEqual() is that assert.partialDeepStrictEqual() does not require all properties in the actual parameter to be present in the expected parameter. This method should always pass the same test cases as assert.deepStrictEqual(), behaving as a super set of it.

  • f
    assert.rejects

    Awaits the asyncFn promise or, if asyncFn is a function, immediately calls the function and awaits the returned promise to complete. It will then check that the promise is rejected.

  • f
    assert.strictEqual

    Tests strict equality between the actual and expected parameters as determined by Object.is().

  • f
    assert.throws

    Expects the function fn to throw an error.

  • I
    assert.CallTrackerCall
  • I
    assert.CallTrackerReportInformation
  • N
    v
    assert.strict

    In strict assertion mode, non-strict methods behave like their corresponding strict methods. For example, deepEqual will behave like deepStrictEqual.

  • T
    assert.AssertPredicate
  • T
    assert.strict.AssertionError
  • T
    assert.strict.AssertPredicate
  • T
    assert.strict.CallTrackerCall
  • T
    assert.strict.CallTrackerReportInformation

node:async_hooks

node:buffer

node:child_process

node:cluster

node:console

node:constants

node:crypto

node:dgram

  • c
    Socket
  • f
    createSocket

    Creates a dgram.Socket object. Once the socket is created, calling socket.bind() will instruct the socket to begin listening for datagram messages. When address and port are not passed to socket.bind() the method will bind the socket to the "all interfaces" address on a random port (it does the right thing for both udp4 and udp6 sockets). The bound address and port can be retrieved using socket.address().address and socket.address().port.

  • I
    BindOptions
  • I
    RemoteInfo
  • I
    SocketOptions
  • T
    SocketType

node:diagnostics_channel

  • c
    Channel

    The class Channel represents an individual named channel within the data pipeline. It is used to track subscribers and to publish messages when there are subscribers present. It exists as a separate object to avoid channel lookups at publish time, enabling very fast publish speeds and allowing for heavy use while incurring very minimal cost. Channels are created with channel, constructing a channel directly with new Channel(name) is not supported.

  • c
    TracingChannel

    The class TracingChannel is a collection of TracingChannel Channels which together express a single traceable action. It is used to formalize and simplify the process of producing events for tracing application flow. tracingChannel is used to construct a TracingChannel. As with Channel it is recommended to create and reuse a single TracingChannel at the top-level of the file rather than creating them dynamically.

  • f
    channel

    This is the primary entry-point for anyone wanting to publish to a named channel. It produces a channel object which is optimized to reduce overhead at publish time as much as possible.

  • f
    hasSubscribers

    Check if there are active subscribers to the named channel. This is helpful if the message you want to send might be expensive to prepare.

  • f
    subscribe

    Register a message handler to subscribe to this channel. This message handler will be run synchronously whenever a message is published to the channel. Any errors thrown in the message handler will trigger an 'uncaughtException'.

  • f
    tracingChannel

    Creates a TracingChannel wrapper for the given TracingChannel Channels. If a name is given, the corresponding tracing channels will be created in the form of tracing:${name}:${eventType} where eventType corresponds to the types of TracingChannel Channels.

  • f
    unsubscribe

    Remove a message handler previously registered to this channel with subscribe.

  • I
    TracingChannelCollection
  • I
    TracingChannelSubscribers
  • T
    ChannelListener

node:dns

node:dns/promises

  • c
    Resolver

    An independent resolver for DNS requests.

  • f
    getDefaultResultOrder

    Get the default value for verbatim in lookup and dnsPromises.lookup(). The value could be:

  • f
    getServers

    Returns an array of IP address strings, formatted according to RFC 5952, that are currently configured for DNS resolution. A string will include a port section if a custom port is used.

  • f
    lookup

    Resolves a host name (e.g. 'nodejs.org') into the first found A (IPv4) or AAAA (IPv6) record. All option properties are optional. If options is an integer, then it must be 4 or 6 – if options is not provided, then IPv4 and IPv6 addresses are both returned if found.

  • f
    lookupService

    Resolves the given address and port into a host name and service using the operating system's underlying getnameinfo implementation.

  • f
    resolve

    Uses the DNS protocol to resolve a host name (e.g. 'nodejs.org') into an array of the resource records. When successful, the Promise is resolved with an array of resource records. The type and structure of individual results vary based on rrtype:

  • f
    resolve4

    Uses the DNS protocol to resolve IPv4 addresses (A records) for the hostname. On success, the Promise is resolved with an array of IPv4 addresses (e.g. ['74.125.79.104', '74.125.79.105', '74.125.79.106']).

  • f
    resolve6

    Uses the DNS protocol to resolve IPv6 addresses (AAAA records) for the hostname. On success, the Promise is resolved with an array of IPv6 addresses.

  • f
    resolveAny

    Uses the DNS protocol to resolve all records (also known as ANY or * query). On success, the Promise is resolved with an array containing various types of records. Each object has a property type that indicates the type of the current record. And depending on the type, additional properties will be present on the object:

  • f
    resolveCaa

    Uses the DNS protocol to resolve CAA records for the hostname. On success, the Promise is resolved with an array of objects containing available certification authority authorization records available for the hostname (e.g. [{critical: 0, iodef: 'mailto:pki@example.com'},{critical: 128, issue: 'pki.example.com'}]).

  • f
    resolveCname

    Uses the DNS protocol to resolve CNAME records for the hostname. On success, the Promise is resolved with an array of canonical name records available for the hostname (e.g. ['bar.example.com']).

  • f
    resolveMx

    Uses the DNS protocol to resolve mail exchange records (MX records) for the hostname. On success, the Promise is resolved with an array of objects containing both a priority and exchange property (e.g.[{priority: 10, exchange: 'mx.example.com'}, ...]).

  • f
    resolveNaptr

    Uses the DNS protocol to resolve regular expression-based records (NAPTR records) for the hostname. On success, the Promise is resolved with an array of objects with the following properties:

  • f
    resolveNs

    Uses the DNS protocol to resolve name server records (NS records) for the hostname. On success, the Promise is resolved with an array of name server records available for hostname (e.g.['ns1.example.com', 'ns2.example.com']).

  • f
    resolvePtr

    Uses the DNS protocol to resolve pointer records (PTR records) for the hostname. On success, the Promise is resolved with an array of strings containing the reply records.

  • f
    resolveSoa

    Uses the DNS protocol to resolve a start of authority record (SOA record) for the hostname. On success, the Promise is resolved with an object with the following properties:

  • f
    resolveSrv

    Uses the DNS protocol to resolve service records (SRV records) for the hostname. On success, the Promise is resolved with an array of objects with the following properties:

  • f
    resolveTxt

    Uses the DNS protocol to resolve text queries (TXT records) for the hostname. On success, the Promise is resolved with a two-dimensional array of the text records available for hostname (e.g.[ ['v=spf1 ip4:0.0.0.0 ', '~all' ] ]). Each sub-array contains TXT chunks of one record. Depending on the use case, these could be either joined together or treated separately.

  • f
    reverse

    Performs a reverse DNS query that resolves an IPv4 or IPv6 address to an array of host names.

  • f
    setDefaultResultOrder

    Set the default value of order in dns.lookup() and [lookup](/api/node/dns/promises/. The value could be:

  • f
    setServers

    Sets the IP address and port of servers to be used when performing DNS resolution. The servers argument is an array of RFC 5952 formatted addresses. If the port is the IANA default DNS port (53) it can be omitted.

  • v
    ADDRGETNETWORKPARAMS
  • v
    BADFAMILY
  • v
    BADFLAGS
  • v
    BADHINTS
  • v
    BADNAME
  • v
    BADQUERY
  • v
    BADRESP
  • v
    BADSTR
  • v
    CANCELLED
  • v
    CONNREFUSED
  • v
    DESTRUCTION
  • v
    EOF
  • v
    FILE
  • v
    FORMERR
  • v
    LOADIPHLPAPI
  • v
    NODATA
  • v
    NOMEM
  • v
    NONAME
  • v
    NOTFOUND
  • v
    NOTIMP
  • v
    NOTINITIALIZED
  • v
    REFUSED
  • v
    SERVFAIL
  • v
    TIMEOUT

node:domain

node:events

node:fs

  • c
    Dir

    A class representing a directory stream.

  • c
    Dirent

    A representation of a directory entry, which can be a file or a subdirectory within the directory, as returned by reading from an fs.Dir. The directory entry is a combination of the file name and file type pairs.

  • c
    ReadStream

    Instances of fs.ReadStream are created and returned using the createReadStream function.

  • c
    WriteStream
  • Extends stream.Writable
  • f
    access

    Tests a user's permissions for the file or directory specified by path. The mode argument is an optional integer that specifies the accessibility checks to be performed. mode should be either the value fs.constants.F_OK or a mask consisting of the bitwise OR of any of fs.constants.R_OK, fs.constants.W_OK, and fs.constants.X_OK (e.g.fs.constants.W_OK | fs.constants.R_OK). Check File access constants for possible values of mode.

  • f
    accessSync

    Synchronously tests a user's permissions for the file or directory specified by path. The mode argument is an optional integer that specifies the accessibility checks to be performed. mode should be either the value fs.constants.F_OK or a mask consisting of the bitwise OR of any of fs.constants.R_OK, fs.constants.W_OK, and fs.constants.X_OK (e.g.fs.constants.W_OK | fs.constants.R_OK). Check File access constants for possible values of mode.

  • f
    appendFile

    Asynchronously append data to a file, creating the file if it does not yet exist. data can be a string or a Buffer.

  • f
    appendFileSync

    Synchronously append data to a file, creating the file if it does not yet exist. data can be a string or a Buffer.

  • f
    chmod

    Asynchronously changes the permissions of a file. No arguments other than a possible exception are given to the completion callback.

  • f
    chmodSync

    For detailed information, see the documentation of the asynchronous version of this API: chmod.

  • f
    chown

    Asynchronously changes owner and group of a file. No arguments other than a possible exception are given to the completion callback.

  • f
    chownSync

    Synchronously changes owner and group of a file. Returns undefined. This is the synchronous version of chown.

  • f
    close

    Closes the file descriptor. No arguments other than a possible exception are given to the completion callback.

  • f
    closeSync

    Closes the file descriptor. Returns undefined.

  • f
    copyFile

    Asynchronously copies src to dest. By default, dest is overwritten if it already exists. No arguments other than a possible exception are given to the callback function. Node.js makes no guarantees about the atomicity of the copy operation. If an error occurs after the destination file has been opened for writing, Node.js will attempt to remove the destination.

  • f
    copyFileSync

    Synchronously copies src to dest. By default, dest is overwritten if it already exists. Returns undefined. Node.js makes no guarantees about the atomicity of the copy operation. If an error occurs after the destination file has been opened for writing, Node.js will attempt to remove the destination.

  • f
    cp

    Asynchronously copies the entire directory structure from src to dest, including subdirectories and files.

  • f
    cpSync

    Synchronously copies the entire directory structure from src to dest, including subdirectories and files.

  • f
    createReadStream

    options can include start and end values to read a range of bytes from the file instead of the entire file. Both start and end are inclusive and start counting at 0, allowed values are in the [0, Number.MAX_SAFE_INTEGER] range. If fd is specified and start is omitted or undefined, fs.createReadStream() reads sequentially from the current file position. The encoding can be any one of those accepted by Buffer.

  • f
    createWriteStream

    options may also include a start option to allow writing data at some position past the beginning of the file, allowed values are in the [0, Number.MAX_SAFE_INTEGER] range. Modifying a file rather than replacing it may require the flags option to be set to r+ rather than the default w. The encoding can be any one of those accepted by Buffer.

  • f
    existsSync

    Returns true if the path exists, false otherwise.

  • f
    fchmod

    Sets the permissions on the file. No arguments other than a possible exception are given to the completion callback.

  • f
    fchmodSync

    Sets the permissions on the file. Returns undefined.

  • f
    fchown

    Sets the owner of the file. No arguments other than a possible exception are given to the completion callback.

  • f
    fchownSync

    Sets the owner of the file. Returns undefined.

  • f
    fdatasync

    Forces all currently queued I/O operations associated with the file to the operating system's synchronized I/O completion state. Refer to the POSIX fdatasync(2) documentation for details. No arguments other than a possible exception are given to the completion callback.

  • f
    fdatasyncSync

    Forces all currently queued I/O operations associated with the file to the operating system's synchronized I/O completion state. Refer to the POSIX fdatasync(2) documentation for details. Returns undefined.

  • f
    fstat

    Invokes the callback with the fs.Stats for the file descriptor.

  • f
    fstatSync

    Retrieves the fs.Stats for the file descriptor.

  • f
    fsync

    Request that all data for the open file descriptor is flushed to the storage device. The specific implementation is operating system and device specific. Refer to the POSIX fsync(2) documentation for more detail. No arguments other than a possible exception are given to the completion callback.

  • f
    fsyncSync

    Request that all data for the open file descriptor is flushed to the storage device. The specific implementation is operating system and device specific. Refer to the POSIX fsync(2) documentation for more detail. Returns undefined.

  • f
    ftruncate

    Truncates the file descriptor. No arguments other than a possible exception are given to the completion callback.

  • f
    ftruncateSync

    Truncates the file descriptor. Returns undefined.

  • f
    futimes

    Change the file system timestamps of the object referenced by the supplied file descriptor. See utimes.

  • f
    futimesSync

    Synchronous version of futimes. Returns undefined.

  • f
    glob

    Retrieves the files matching the specified pattern.

  • f
    globSync

    Retrieves the files matching the specified pattern.

  • f
    lchown

    Set the owner of the symbolic link. No arguments other than a possible exception are given to the completion callback.

  • f
    lchownSync

    Set the owner for the path. Returns undefined.

  • f
    link

    Creates a new link from the existingPath to the newPath. See the POSIX link(2) documentation for more detail. No arguments other than a possible exception are given to the completion callback.

  • f
    linkSync

    Creates a new link from the existingPath to the newPath. See the POSIX link(2) documentation for more detail. Returns undefined.

  • f
    lstat

    Retrieves the fs.Stats for the symbolic link referred to by the path. The callback gets two arguments (err, stats) where stats is a fs.Stats object. lstat() is identical to stat(), except that if path is a symbolic link, then the link itself is stat-ed, not the file that it refers to.

  • f
    lutimes

    Changes the access and modification times of a file in the same way as utimes, with the difference that if the path refers to a symbolic link, then the link is not dereferenced: instead, the timestamps of the symbolic link itself are changed.

  • f
    lutimesSync

    Change the file system timestamps of the symbolic link referenced by path. Returns undefined, or throws an exception when parameters are incorrect or the operation fails. This is the synchronous version of lutimes.

  • f
    mkdir

    Asynchronously creates a directory.

  • f
    mkdirSync

    Synchronously creates a directory. Returns undefined, or if recursive is true, the first directory path created. This is the synchronous version of mkdir.

  • f
    mkdtemp

    Creates a unique temporary directory.

  • f
    mkdtempSync

    Returns the created directory path.

  • f
    open

    Asynchronous file open. See the POSIX open(2) documentation for more details.

  • f
    openAsBlob

    Returns a Blob whose data is backed by the given file.

  • f
    opendir

    Asynchronously open a directory. See the POSIX opendir(3) documentation for more details.

  • f
    opendirSync

    Synchronously open a directory. See opendir(3).

  • f
    openSync

    Returns an integer representing the file descriptor.

  • f
    promises.access

    Tests a user's permissions for the file or directory specified by path. The mode argument is an optional integer that specifies the accessibility checks to be performed. mode should be either the value fs.constants.F_OK or a mask consisting of the bitwise OR of any of fs.constants.R_OK, fs.constants.W_OK, and fs.constants.X_OK (e.g.fs.constants.W_OK | fs.constants.R_OK). Check File access constants for possible values of mode.

  • f
    promises.appendFile

    Asynchronously append data to a file, creating the file if it does not yet exist. data can be a string or a Buffer.

  • f
    promises.chmod

    Changes the permissions of a file.

  • f
    promises.chown

    Changes the ownership of a file.

  • f
    promises.copyFile

    Asynchronously copies src to dest. By default, dest is overwritten if it already exists.

  • f
    promises.cp

    Asynchronously copies the entire directory structure from src to dest, including subdirectories and files.

  • f
    promises.glob

    Retrieves the files matching the specified pattern.

  • f
    promises.lchown

    Changes the ownership on a symbolic link.

  • f
    promises.link

    Creates a new link from the existingPath to the newPath. See the POSIX link(2) documentation for more detail.

  • f
    promises.lstat

    Equivalent to fsPromises.stat() unless path refers to a symbolic link, in which case the link itself is stat-ed, not the file that it refers to. Refer to the POSIX lstat(2) document for more detail.

  • f
    promises.lutimes

    Changes the access and modification times of a file in the same way as fsPromises.utimes(), with the difference that if the path refers to a symbolic link, then the link is not dereferenced: instead, the timestamps of the symbolic link itself are changed.

  • f
    promises.mkdir

    Asynchronously creates a directory.

  • f
    promises.mkdtemp

    Creates a unique temporary directory. A unique directory name is generated by appending six random characters to the end of the provided prefix. Due to platform inconsistencies, avoid trailing X characters in prefix. Some platforms, notably the BSDs, can return more than six random characters, and replace trailing X characters in prefix with random characters.

  • f
    promises.open

    Opens a FileHandle.

  • f
    promises.opendir

    Asynchronously open a directory for iterative scanning. See the POSIX opendir(3) documentation for more detail.

  • f
    promises.readdir

    Reads the contents of a directory.

  • f
    promises.readFile

    Asynchronously reads the entire contents of a file.

  • f
    promises.readlink

    Reads the contents of the symbolic link referred to by path. See the POSIX readlink(2) documentation for more detail. The promise is fulfilled with thelinkString upon success.

  • f
    promises.realpath

    Determines the actual location of path using the same semantics as the fs.realpath.native() function.

  • f
    promises.rename

    Renames oldPath to newPath.

  • f
    promises.rm

    Removes files and directories (modeled on the standard POSIX rm utility).

  • f
    promises.rmdir

    Removes the directory identified by path.

  • f
    promises.stat
  • f
    promises.statfs
  • f
    promises.symlink

    Creates a symbolic link.

  • f
    promises.truncate

    Truncates (shortens or extends the length) of the content at path to len bytes.

  • f
    promises.unlink

    If path refers to a symbolic link, then the link is removed without affecting the file or directory to which that link refers. If the path refers to a file path that is not a symbolic link, the file is deleted. See the POSIX unlink(2) documentation for more detail.

  • f
    promises.utimes

    Change the file system timestamps of the object referenced by path.

  • f
    promises.watch

    Returns an async iterator that watches for changes on filename, where filenameis either a file or a directory.

  • f
    promises.writeFile

    Asynchronously writes data to a file, replacing the file if it already exists. data can be a string, a buffer, an AsyncIterable, or an Iterable object.

  • f
    read

    Read data from the file specified by fd.

  • f
    readdir

    Reads the contents of a directory. The callback gets two arguments (err, files) where files is an array of the names of the files in the directory excluding '.' and '..'.

  • f
    readdirSync

    Reads the contents of the directory.

  • f
    readFile

    Asynchronously reads the entire contents of a file.

  • f
    readFileSync

    Returns the contents of the path.

  • f
    readlink

    Reads the contents of the symbolic link referred to by path. The callback gets two arguments (err, linkString).

  • f
    readlinkSync

    Returns the symbolic link's string value.

  • f
    readSync

    Returns the number of bytesRead.

  • f
    readv

    Read from a file specified by fd and write to an array of ArrayBufferViews using readv().

  • f
    readvSync

    For detailed information, see the documentation of the asynchronous version of this API: readv.

  • f
    N
    realpath

    Asynchronously computes the canonical pathname by resolving ., .., and symbolic links.

  • f
    realpath.native

    Asynchronous realpath(3).

  • f
    N
    realpathSync

    Returns the resolved pathname.

  • f
    realpathSync.native
  • f
    rename

    Asynchronously rename file at oldPath to the pathname provided as newPath. In the case that newPath already exists, it will be overwritten. If there is a directory at newPath, an error will be raised instead. No arguments other than a possible exception are given to the completion callback.

  • f
    renameSync

    Renames the file from oldPath to newPath. Returns undefined.

  • f
    rm

    Asynchronously removes files and directories (modeled on the standard POSIX rm utility). No arguments other than a possible exception are given to the completion callback.

  • f
    rmdir

    Asynchronous rmdir(2). No arguments other than a possible exception are given to the completion callback.

  • f
    rmdirSync

    Synchronous rmdir(2). Returns undefined.

  • f
    rmSync

    Synchronously removes files and directories (modeled on the standard POSIX rm utility). Returns undefined.

  • f
    stat

    Asynchronous stat(2). The callback gets two arguments (err, stats) wherestats is an fs.Stats object.

  • f
    statfs

    Asynchronous statfs(2). Returns information about the mounted file system which contains path. The callback gets two arguments (err, stats) where statsis an fs.StatFs object.

  • f
    statfsSync

    Synchronous statfs(2). Returns information about the mounted file system which contains path.

  • f
    N
    symlink

    Creates the link called path pointing to target. No arguments other than a possible exception are given to the completion callback.

  • f
    symlinkSync

    Returns undefined.

  • f
    truncate

    Truncates the file. No arguments other than a possible exception are given to the completion callback. A file descriptor can also be passed as the first argument. In this case, fs.ftruncate() is called.

  • f
    truncateSync

    Truncates the file. Returns undefined. A file descriptor can also be passed as the first argument. In this case, fs.ftruncateSync() is called.

  • f
    unlink

    Asynchronously removes a file or symbolic link. No arguments other than a possible exception are given to the completion callback.

  • f
    unlinkSync

    Synchronous unlink(2). Returns undefined.

  • f
    unwatchFile

    Stop watching for changes on filename. If listener is specified, only that particular listener is removed. Otherwise, all listeners are removed, effectively stopping watching of filename.

  • f
    utimes

    Change the file system timestamps of the object referenced by path.

  • f
    utimesSync

    Returns undefined.

  • f
    watch

    Watch for changes on filename, where filename is either a file or a directory.

  • f
    watchFile

    Watch for changes on filename. The callback listener will be called each time the file is accessed.

  • f
    write

    Write buffer to the file specified by fd.

  • f
    writeFile
  • f
    writeFileSync
  • f
    writeSync

    For detailed information, see the documentation of the asynchronous version of this API: write.

  • f
    writev

    Write an array of ArrayBufferViews to the file specified by fd using writev().

  • f
    writevSync

    For detailed information, see the documentation of the asynchronous version of this API: writev.

  • f
    exists

    Test whether or not the given path exists by checking with the file system. Then call the callback argument with either true or false:

  • f
    lchmod

    Changes the permissions on a symbolic link. No arguments other than a possible exception are given to the completion callback.

  • f
    lchmodSync

    Changes the permissions on a symbolic link. Returns undefined.

  • f
    promises.lchmod
  • I
    _GlobOptions
  • I
    BigIntOptions
  • I
    BigIntStats
  • I
    BigIntStatsFs
  • I
    CopyOptions
  • I
    CopyOptionsBase
  • I
    CopySyncOptions
  • I
    CreateReadStreamFSImplementation
  • I
    CreateWriteStreamFSImplementation
  • I
    FSImplementation
  • I
    FSWatcher
  • I
    GlobOptions
  • I
    GlobOptionsWithFileTypes
  • I
    GlobOptionsWithoutFileTypes
  • I
    MakeDirectoryOptions
  • I
    ObjectEncodingOptions
  • I
    OpenAsBlobOptions
  • I
    OpenDirOptions
  • I
    promises.CreateReadStreamOptions
  • I
    promises.CreateWriteStreamOptions
  • I
    promises.FileChangeInfo
  • I
    promises.FileHandle
  • I
    promises.FileReadOptions
  • I
    promises.FileReadResult
  • I
    promises.FlagAndOpenMode
  • I
    promises.ReadableWebStreamOptions
  • I
    ReadAsyncOptions
  • I
    ReadStreamOptions
  • I
    ReadSyncOptions
  • I
    ReadVResult
  • I
    RmDirOptions
  • I
    RmOptions
  • I
    StatFsOptions
  • I
    StatOptions
  • c
    I
    Stats

    A fs.Stats object provides information about a file.

  • I
    StatsBase
  • c
    I
    StatsFs

    Provides information about a mounted file system.

  • I
    StatsFsBase
  • I
    StatSyncFn
  • I
    StatSyncOptions
  • I
    StatWatcher

    Class: fs.StatWatcher

  • I
    StreamOptions
  • I
    WatchFileOptions

    Watch for changes on filename. The callback listener will be called each time the file is accessed.

  • I
    WatchOptions
  • I
    WriteStreamOptions
  • I
    WriteVResult
  • N
    constants
  • N
    promises

    The fs/promises API provides asynchronous file system methods that return promises.

  • T
    BigIntStatsListener
  • T
    BufferEncodingOption
  • T
    CustomEvents

    string & {} allows to allow any kind of strings for the event but still allows to have auto completion for the normal events.

  • T
    EncodingOption
  • T
    Mode
  • T
    NoParamCallback
  • T
    OpenMode
  • T
    PathLike

    Valid types for path values in "fs".

  • T
    PathOrFileDescriptor
  • T
    ReadPosition
  • T
    ReadStreamEvents

    The Keys are events of the ReadStream and the values are the functions that are called when the event is emitted.

  • T
    StatsListener
  • T
    symlink.Type
  • T
    TimeLike
  • T
    WatchEventType
  • T
    WatchListener
  • T
    WriteFileOptions
  • T
    WriteStreamEvents

    The Keys are events of the WriteStream and the values are the functions that are called when the event is emitted.

  • v
    constants.COPYFILE_EXCL

    Constant for fs.copyFile. Flag indicating the destination file should not be overwritten if it already exists.

  • v
    constants.COPYFILE_FICLONE

    Constant for fs.copyFile. copy operation will attempt to create a copy-on-write reflink. If the underlying platform does not support copy-on-write, then a fallback copy mechanism is used.

  • v
    constants.COPYFILE_FICLONE_FORCE

    Constant for fs.copyFile. Copy operation will attempt to create a copy-on-write reflink. If the underlying platform does not support copy-on-write, then the operation will fail with an error.

  • v
    constants.F_OK

    Constant for fs.access(). File is visible to the calling process.

  • v
    constants.O_APPEND

    Constant for fs.open(). Flag indicating that data will be appended to the end of the file.

  • v
    constants.O_CREAT

    Constant for fs.open(). Flag indicating to create the file if it does not already exist.

  • v
    constants.O_DIRECT

    Constant for fs.open(). When set, an attempt will be made to minimize caching effects of file I/O.

  • v
    constants.O_DIRECTORY

    Constant for fs.open(). Flag indicating that the open should fail if the path is not a directory.

  • v
    constants.O_DSYNC

    Constant for fs.open(). Flag indicating that the file is opened for synchronous I/O with write operations waiting for data integrity.

  • v
    constants.O_EXCL

    Constant for fs.open(). Flag indicating that opening a file should fail if the O_CREAT flag is set and the file already exists.

  • v
    constants.O_NOATIME

    constant for fs.open(). Flag indicating reading accesses to the file system will no longer result in an update to the atime information associated with the file. This flag is available on Linux operating systems only.

  • v
    constants.O_NOCTTY

    Constant for fs.open(). Flag indicating that if path identifies a terminal device, opening the path shall not cause that terminal to become the controlling terminal for the process (if the process does not already have one).

  • v
    constants.O_NOFOLLOW

    Constant for fs.open(). Flag indicating that the open should fail if the path is a symbolic link.

  • v
    constants.O_NONBLOCK

    Constant for fs.open(). Flag indicating to open the file in nonblocking mode when possible.

  • v
    constants.O_RDONLY

    Constant for fs.open(). Flag indicating to open a file for read-only access.

  • v
    constants.O_RDWR

    Constant for fs.open(). Flag indicating to open a file for read-write access.

  • v
    constants.O_SYMLINK

    Constant for fs.open(). Flag indicating to open the symbolic link itself rather than the resource it is pointing to.

  • v
    constants.O_SYNC

    Constant for fs.open(). Flag indicating that the file is opened for synchronous I/O.

  • v
    constants.O_TRUNC

    Constant for fs.open(). Flag indicating that if the file exists and is a regular file, and the file is opened successfully for write access, its length shall be truncated to zero.

  • v
    constants.O_WRONLY

    Constant for fs.open(). Flag indicating to open a file for write-only access.

  • v
    constants.R_OK

    Constant for fs.access(). File can be read by the calling process.

  • v
    constants.S_IFBLK

    Constant for fs.Stats mode property for determining a file's type. File type constant for a block-oriented device file.

  • v
    constants.S_IFCHR

    Constant for fs.Stats mode property for determining a file's type. File type constant for a character-oriented device file.

  • v
    constants.S_IFDIR

    Constant for fs.Stats mode property for determining a file's type. File type constant for a directory.

  • v
    constants.S_IFIFO

    Constant for fs.Stats mode property for determining a file's type. File type constant for a FIFO/pipe.

  • v
    constants.S_IFLNK

    Constant for fs.Stats mode property for determining a file's type. File type constant for a symbolic link.

  • v
    constants.S_IFMT

    Constant for fs.Stats mode property for determining a file's type. Bit mask used to extract the file type code.

  • v
    constants.S_IFREG

    Constant for fs.Stats mode property for determining a file's type. File type constant for a regular file.

  • v
    constants.S_IFSOCK

    Constant for fs.Stats mode property for determining a file's type. File type constant for a socket.

  • v
    constants.S_IRGRP

    Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable by group.

  • v
    constants.S_IROTH

    Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable by others.

  • v
    constants.S_IRUSR

    Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable by owner.

  • v
    constants.S_IRWXG

    Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable, writable and executable by group.

  • v
    constants.S_IRWXO

    Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable, writable and executable by others.

  • v
    constants.S_IRWXU

    Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable, writable and executable by owner.

  • v
    constants.S_IWGRP

    Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating writable by group.

  • v
    constants.S_IWOTH

    Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating writable by others.

  • v
    constants.S_IWUSR

    Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating writable by owner.

  • v
    constants.S_IXGRP

    Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating executable by group.

  • v
    constants.S_IXOTH

    Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating executable by others.

  • v
    constants.S_IXUSR

    Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating executable by owner.

  • v
    constants.UV_FS_O_FILEMAP

    When set, a memory file mapping is used to access the file. This flag is available on Windows operating systems only. On other operating systems, this flag is ignored.

  • v
    constants.W_OK

    Constant for fs.access(). File can be written by the calling process.

  • v
    constants.X_OK

    Constant for fs.access(). File can be executed by the calling process.

  • v
    lstatSync

    Synchronous lstat(2) - Get file status. Does not dereference symbolic links.

  • v
    promises.constants
  • v
    statSync

    Synchronous stat(2) - Get file status.

  • node:fs/promises

    • f
      access

      Tests a user's permissions for the file or directory specified by path. The mode argument is an optional integer that specifies the accessibility checks to be performed. mode should be either the value fs.constants.F_OK or a mask consisting of the bitwise OR of any of fs.constants.R_OK, fs.constants.W_OK, and fs.constants.X_OK (e.g.fs.constants.W_OK | fs.constants.R_OK). Check File access constants for possible values of mode.

    • f
      appendFile

      Asynchronously append data to a file, creating the file if it does not yet exist. data can be a string or a Buffer.

    • f
      chmod

      Changes the permissions of a file.

    • f
      chown

      Changes the ownership of a file.

    • f
      copyFile

      Asynchronously copies src to dest. By default, dest is overwritten if it already exists.

    • f
      cp

      Asynchronously copies the entire directory structure from src to dest, including subdirectories and files.

    • f
      glob

      Retrieves the files matching the specified pattern.

    • f
      lchown

      Changes the ownership on a symbolic link.

    • f
      link

      Creates a new link from the existingPath to the newPath. See the POSIX link(2) documentation for more detail.

    • f
      lstat

      Equivalent to fsPromises.stat() unless path refers to a symbolic link, in which case the link itself is stat-ed, not the file that it refers to. Refer to the POSIX lstat(2) document for more detail.

    • f
      lutimes

      Changes the access and modification times of a file in the same way as fsPromises.utimes(), with the difference that if the path refers to a symbolic link, then the link is not dereferenced: instead, the timestamps of the symbolic link itself are changed.

    • f
      mkdir

      Asynchronously creates a directory.

    • f
      mkdtemp

      Creates a unique temporary directory. A unique directory name is generated by appending six random characters to the end of the provided prefix. Due to platform inconsistencies, avoid trailing X characters in prefix. Some platforms, notably the BSDs, can return more than six random characters, and replace trailing X characters in prefix with random characters.

    • f
      open

      Opens a FileHandle.

    • f
      opendir

      Asynchronously open a directory for iterative scanning. See the POSIX opendir(3) documentation for more detail.

    • f
      readdir

      Reads the contents of a directory.

    • f
      readFile

      Asynchronously reads the entire contents of a file.

    • f
      readlink

      Reads the contents of the symbolic link referred to by path. See the POSIX readlink(2) documentation for more detail. The promise is fulfilled with thelinkString upon success.

    • f
      realpath

      Determines the actual location of path using the same semantics as the fs.realpath.native() function.

    • f
      rename

      Renames oldPath to newPath.

    • f
      rm

      Removes files and directories (modeled on the standard POSIX rm utility).

    • f
      rmdir

      Removes the directory identified by path.

    • f
      stat
    • f
      statfs
    • f
      symlink

      Creates a symbolic link.

    • f
      truncate

      Truncates (shortens or extends the length) of the content at path to len bytes.

    • f
      unlink

      If path refers to a symbolic link, then the link is removed without affecting the file or directory to which that link refers. If the path refers to a file path that is not a symbolic link, the file is deleted. See the POSIX unlink(2) documentation for more detail.

    • f
      utimes

      Change the file system timestamps of the object referenced by path.

    • f
      watch

      Returns an async iterator that watches for changes on filename, where filenameis either a file or a directory.

    • f
      writeFile

      Asynchronously writes data to a file, replacing the file if it already exists. data can be a string, a buffer, an AsyncIterable, or an Iterable object.

    • f
      lchmod
    • I
      CreateReadStreamOptions
    • I
      CreateWriteStreamOptions
    • I
      FileChangeInfo
    • I
      FileHandle
    • I
      FileReadOptions
    • I
      FileReadResult
    • I
      FlagAndOpenMode
    • I
      ReadableWebStreamOptions
    • v
      constants

    node:http

    node:http2

    node:https

    node:inspector

    node:inspector/promises

    node:module

    • c
      I
      N
      Module
    • c
      Module.SourceMap
    • f
      Module.createRequire
    • f
      Module.enableCompileCache

      Enable module compile cache in the current Node.js instance.

    • f
      Module.findPackageJSON
      // /path/to/project/packages/bar/bar.js
      import { findPackageJSON } from 'node:module';
      
      findPackageJSON('..', import.meta.url);
      // '/path/to/project/package.json'
      // Same result when passing an absolute specifier instead:
      findPackageJSON(new URL('../', import.meta.url));
      findPackageJSON(import.meta.resolve('../'));
      
      findPackageJSON('some-package', import.meta.url);
      // '/path/to/project/packages/bar/node_modules/some-package/package.json'
      // When passing an absolute specifier, you might get a different result if the
      // resolved module is inside a subfolder that has nested `package.json`.
      findPackageJSON(import.meta.resolve('some-package'));
      // '/path/to/project/packages/bar/node_modules/some-package/some-subfolder/package.json'
      
      findPackageJSON('@foo/qux', import.meta.url);
      // '/path/to/project/packages/qux/package.json'
      
    • f
      Module.findSourceMap

      path is the resolved path for the file for which a corresponding source map should be fetched.

    • f
      Module.flushCompileCache

      Flush the module compile cache accumulated from modules already loaded in the current Node.js instance to disk. This returns after all the flushing file system operations come to an end, no matter they succeed or not. If there are any errors, this will fail silently, since compile cache misses should not interfere with the actual operation of the application.

    • f
      Module.getCompileCacheDir
    • f
      Module.isBuiltin
    • f
      Module.register

      Register a module that exports hooks that customize Node.js module resolution and loading behavior. See Customization hooks.

    • f
      Module.runMain
    • f
      Module.stripTypeScriptTypes

      module.stripTypeScriptTypes() removes type annotations from TypeScript code. It can be used to strip type annotations from TypeScript code before running it with vm.runInContext() or vm.compileFunction(). By default, it will throw an error if the code contains TypeScript features that require transformation such as Enums, see type-stripping for more information. When mode is 'transform', it also transforms TypeScript features to JavaScript, see transform TypeScript features for more information. When mode is 'strip', source maps are not generated, because locations are preserved. If sourceMap is provided, when mode is 'strip', an error will be thrown.

    • f
      Module.syncBuiltinESMExports

      The module.syncBuiltinESMExports() method updates all the live bindings for builtin ES Modules to match the properties of the CommonJS exports. It does not add or remove exported names from the ES Modules.

    • f
      Module.wrap
    • I
      ImportMeta
    • I
      Module.EnableCompileCacheResult
    • I
      Module.ImportAttributes
    • I
      Module.LoadFnOutput
    • I
      Module.LoadHookContext
    • I
      Module.RegisterOptions
    • I
      Module.ResolveFnOutput
    • I
      Module.ResolveHookContext
    • I
      Module.SourceMapConstructorOptions
    • I
      Module.SourceMapPayload
    • I
      Module.SourceMapping
    • I
      Module.SourceOrigin
    • I
      Module.StripTypeScriptTypesOptions
    • I
      Require
    • I
      RequireResolve
    • I
      RequireResolveOptions
    • I
      NodeModule
    • I
      NodeRequire
    • I
      RequireExtensions
    • N
      Module.constants
    • N
      Module.constants.compileCacheStatus

      The following constants are returned as the status field in the object returned by enableCompileCache to indicate the result of the attempt to enable the module compile cache.

    • T
      Module.InitializeHook

      The initialize hook provides a way to define a custom function that runs in the hooks thread when the hooks module is initialized. Initialization happens when the hooks module is registered via register.

    • T
      Module.LoadHook

      The load hook provides a way to define a custom method of determining how a URL should be interpreted, retrieved, and parsed. It is also in charge of validating the import attributes.

    • T
      Module.ModuleFormat
    • T
      Module.ModuleSource
    • T
      Module.ResolveHook

      The resolve hook chain is responsible for telling Node.js where to find and how to cache a given import statement or expression, or require call. It can optionally return a format (such as 'module') as a hint to the load hook. If a format is specified, the load hook is ultimately responsible for providing the final format value (and it is free to ignore the hint provided by resolve); if resolve provides a format, a custom load hook is required even if only to pass the value to the Node.js default load hook.

    • v
      __dirname

      The directory name of the current module. This is the same as the path.dirname() of the __filename.

    • v
      __filename

      The file name of the current module. This is the current module file's absolute path with symlinks resolved.

    • v
      exports

      The exports variable is available within a module's file-level scope, and is assigned the value of module.exports before the module is evaluated.

    • v
      module

      A reference to the current module.

    • v
      Module.builtinModules

      A list of the names of all modules provided by Node.js. Can be used to verify if a module is maintained by a third party or not.

    • v
      Module.constants.compileCacheStatus.ALREADY_ENABLED

      The compile cache has already been enabled before, either by a previous call to enableCompileCache, or by the NODE_COMPILE_CACHE=dir environment variable. The directory used to store the compile cache will be returned in the directory field in the returned object.

    • v
      Module.constants.compileCacheStatus.DISABLED

      Node.js cannot enable the compile cache because the environment variable NODE_DISABLE_COMPILE_CACHE=1 has been set.

    • v
      Module.constants.compileCacheStatus.ENABLED

      Node.js has enabled the compile cache successfully. The directory used to store the compile cache will be returned in the directory field in the returned object.

    • v
      Module.constants.compileCacheStatus.FAILED

      Node.js fails to enable the compile cache. This can be caused by the lack of permission to use the specified directory, or various kinds of file system errors. The detail of the failure will be returned in the message field in the returned object.

    • v
      require

    node:net

    node:os

    node:path

    node:perf_hooks

    node:process

    node:punycode

    • f
      decode

      The punycode.decode() method converts a Punycode string of ASCII-only characters to the equivalent string of Unicode codepoints.

    • f
      encode

      The punycode.encode() method converts a string of Unicode codepoints to a Punycode string of ASCII-only characters.

    • f
      toASCII

      The punycode.toASCII() method converts a Unicode string representing an Internationalized Domain Name to Punycode. Only the non-ASCII parts of the domain name will be converted. Calling punycode.toASCII() on a string that already only contains ASCII characters will have no effect.

    • f
      toUnicode

      The punycode.toUnicode() method converts a string representing a domain name containing Punycode encoded characters into Unicode. Only the Punycode encoded parts of the domain name are be converted.

    • I
      v
      ucs2
    • v
      version

    node:querystring

    • f
      escape

      The querystring.escape() method performs URL percent-encoding on the given str in a manner that is optimized for the specific requirements of URL query strings.

    • f
      parse

      The querystring.parse() method parses a URL query string (str) into a collection of key and value pairs.

    • f
      stringify

      The querystring.stringify() method produces a URL query string from a given obj by iterating through the object's "own properties".

    • f
      unescape

      The querystring.unescape() method performs decoding of URL percent-encoded characters on the given str.

    • I
      ParsedUrlQuery
    • I
      ParsedUrlQueryInput
    • I
      ParseOptions
    • I
      StringifyOptions

      The node:querystring module provides utilities for parsing and formatting URL query strings. It can be accessed using:

    • v
      decode

      The querystring.decode() function is an alias for querystring.parse().

    • v
      encode

      The querystring.encode() function is an alias for querystring.stringify().

    node:readline

    • c
      Interface

      Instances of the readline.Interface class are constructed using the readline.createInterface() method. Every instance is associated with a single input Readable stream and a single output Writable stream. The output stream is used to print prompts for user input that arrives on, and is read from, the input stream.

    • c
      promises.Interface

      Instances of the readlinePromises.Interface class are constructed using the readlinePromises.createInterface() method. Every instance is associated with a single input Readable stream and a single output Writable stream. The output stream is used to print prompts for user input that arrives on, and is read from, the input stream.

    • c
      promises.Readline
    • f
      clearLine

      The readline.clearLine() method clears current line of given TTY stream in a specified direction identified by dir.

    • f
      clearScreenDown

      The readline.clearScreenDown() method clears the given TTY stream from the current position of the cursor down.

    • f
      createInterface

      The readline.createInterface() method creates a new readline.Interface instance.

    • f
      cursorTo

      The readline.cursorTo() method moves cursor to the specified position in a given TTY stream.

    • f
      emitKeypressEvents

      The readline.emitKeypressEvents() method causes the given Readable stream to begin emitting 'keypress' events corresponding to received input.

    • f
      moveCursor

      The readline.moveCursor() method moves the cursor relative to its current position in a given TTY stream.

    • f
      promises.createInterface

      The readlinePromises.createInterface() method creates a new readlinePromises.Interface instance.

    • I
      CursorPos
    • I
      Key
    • I
      promises.ReadLineOptions
    • I
      ReadLineOptions
    • N
      promises
    • T
      AsyncCompleter
    • T
      Completer
    • T
      CompleterResult
    • T
      Direction
    • T
      promises.Completer
    • T
      ReadLine

    node:readline/promises

    • c
      Interface

      Instances of the readlinePromises.Interface class are constructed using the readlinePromises.createInterface() method. Every instance is associated with a single input Readable stream and a single output Writable stream. The output stream is used to print prompts for user input that arrives on, and is read from, the input stream.

    • c
      Readline
    • f
      createInterface

      The readlinePromises.createInterface() method creates a new readlinePromises.Interface instance.

    • I
      ReadLineOptions
    • T
      Completer

    node:repl

    node:sea

    node:sqlite

    node:stream

    node:stream/consumers

    node:stream/promises

    node:stream/web

    node:string_decoder

    • c
      StringDecoder

      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:

    node:test

    • c
      MockFunctionContext

      The MockFunctionContext class is used to inspect or manipulate the behavior of mocks created via the MockTracker APIs.

    • c
      MockModuleContext
    • c
      MockTimers

      Mocking timers is a technique commonly used in software testing to simulate and control the behavior of timers, such as setInterval and setTimeout, without actually waiting for the specified time intervals.

    • c
      MockTracker

      The MockTracker class is used to manage mocking functionality. The test runner module provides a top level mock export which is a MockTracker instance. Each test also provides its own MockTracker instance via the test context's mock property.

    • c
      SuiteContext

      An instance of SuiteContext is passed to each suite function in order to interact with the test runner. However, the SuiteContext constructor is not exposed as part of the API.

    • c
      TestContext

      An instance of TestContext is passed to each test function in order to interact with the test runner. However, the TestContext constructor is not exposed as part of the API.

    • c
      TestsStream

      A successful call to run() will return a new TestsStream object, streaming a series of events representing the execution of the tests.

    • f
      after

      This function creates a hook that runs after executing a suite.

    • f
      afterEach

      This function creates a hook that runs after each test in the current suite. The afterEach() hook is run even if the test fails.

    • f
      assert.register

      Defines a new assertion function with the provided name and function. If an assertion already exists with the same name, it is overwritten.

    • f
      before

      This function creates a hook that runs before executing a suite.

    • f
      beforeEach

      This function creates a hook that runs before each test in the current suite.

    • f
      N
      default

      The test() function is the value imported from the test module. Each invocation of this function results in reporting the test to the TestsStream.

    • f
      default.after

      This function creates a hook that runs after executing a suite.

    • f
      default.afterEach

      This function creates a hook that runs after each test in the current suite. The afterEach() hook is run even if the test fails.

    • f
      default.assert.register

      Defines a new assertion function with the provided name and function. If an assertion already exists with the same name, it is overwritten.

    • f
      default.before

      This function creates a hook that runs before executing a suite.

    • f
      default.beforeEach

      This function creates a hook that runs before each test in the current suite.

    • f
      N
      default.describe

      Alias for suite.

    • f
      default.describe.only

      Shorthand for marking a suite as only. This is the same as calling describe with options.only set to true.

    • f
      default.describe.skip

      Shorthand for skipping a suite. This is the same as calling describe with options.skip set to true.

    • f
      default.describe.todo

      Shorthand for marking a suite as TODO. This is the same as calling describe with options.todo set to true.

    • f
      N
      default.it

      Alias for test.

    • f
      default.it.only

      Shorthand for marking a test as only. This is the same as calling it with options.only set to true.

    • f
      default.it.skip

      Shorthand for skipping a test. This is the same as calling it with options.skip set to true.

    • f
      default.it.todo

      Shorthand for marking a test as TODO. This is the same as calling it with options.todo set to true.

    • f
      default.only

      Shorthand for marking a test as only. This is the same as calling test with options.only set to true.

    • f
      default.run

      Note: shard is used to horizontally parallelize test running across machines or processes, ideal for large-scale executions across varied environments. It's incompatible with watch mode, tailored for rapid code iteration by automatically rerunning tests on file changes.

    • f
      default.skip

      Shorthand for skipping a test. This is the same as calling test with options.skip set to true.

    • f
      default.snapshot.setDefaultSnapshotSerializers

      This function is used to customize the default serialization mechanism used by the test runner.

    • f
      default.snapshot.setResolveSnapshotPath

      This function is used to set a custom resolver for the location of the snapshot file used for snapshot testing. By default, the snapshot filename is the same as the entry point filename with .snapshot appended.

    • f
      N
      default.suite

      The suite() function is imported from the node:test module.

    • f
      default.suite.only

      Shorthand for marking a suite as only. This is the same as calling suite with options.only set to true.

    • f
      default.suite.skip

      Shorthand for skipping a suite. This is the same as calling suite with options.skip set to true.

    • f
      default.suite.todo

      Shorthand for marking a suite as TODO. This is the same as calling suite with options.todo set to true.

    • f
      default.todo

      Shorthand for marking a test as TODO. This is the same as calling test with options.todo set to true.

    • f
      N
      describe

      Alias for suite.

    • f
      describe.only

      Shorthand for marking a suite as only. This is the same as calling describe with options.only set to true.

    • f
      describe.skip

      Shorthand for skipping a suite. This is the same as calling describe with options.skip set to true.

    • f
      describe.todo

      Shorthand for marking a suite as TODO. This is the same as calling describe with options.todo set to true.

    • f
      N
      it

      Alias for test.

    • f
      it.only

      Shorthand for marking a test as only. This is the same as calling it with options.only set to true.

    • f
      it.skip

      Shorthand for skipping a test. This is the same as calling it with options.skip set to true.

    • f
      it.todo

      Shorthand for marking a test as TODO. This is the same as calling it with options.todo set to true.

    • f
      only

      Shorthand for marking a test as only. This is the same as calling test with options.only set to true.

    • f
      run

      Note: shard is used to horizontally parallelize test running across machines or processes, ideal for large-scale executions across varied environments. It's incompatible with watch mode, tailored for rapid code iteration by automatically rerunning tests on file changes.

    • f
      skip

      Shorthand for skipping a test. This is the same as calling test with options.skip set to true.

    • f
      snapshot.setDefaultSnapshotSerializers

      This function is used to customize the default serialization mechanism used by the test runner.

    • f
      snapshot.setResolveSnapshotPath

      This function is used to set a custom resolver for the location of the snapshot file used for snapshot testing. By default, the snapshot filename is the same as the entry point filename with .snapshot appended.

    • f
      N
      suite

      The suite() function is imported from the node:test module.

    • f
      suite.only

      Shorthand for marking a suite as only. This is the same as calling suite with options.only set to true.

    • f
      suite.skip

      Shorthand for skipping a suite. This is the same as calling suite with options.skip set to true.

    • f
      suite.todo

      Shorthand for marking a suite as TODO. This is the same as calling suite with options.todo set to true.

    • f
      N
      test

      The test() function is the value imported from the test module. Each invocation of this function results in reporting the test to the TestsStream.

    • f
      test.after

      This function creates a hook that runs after executing a suite.

    • f
      test.afterEach

      This function creates a hook that runs after each test in the current suite. The afterEach() hook is run even if the test fails.

    • f
      test.assert.register

      Defines a new assertion function with the provided name and function. If an assertion already exists with the same name, it is overwritten.

    • f
      test.before

      This function creates a hook that runs before executing a suite.

    • f
      test.beforeEach

      This function creates a hook that runs before each test in the current suite.

    • f
      N
      test.describe

      Alias for suite.

    • f
      test.describe.only

      Shorthand for marking a suite as only. This is the same as calling describe with options.only set to true.

    • f
      test.describe.skip

      Shorthand for skipping a suite. This is the same as calling describe with options.skip set to true.

    • f
      test.describe.todo

      Shorthand for marking a suite as TODO. This is the same as calling describe with options.todo set to true.

    • f
      N
      test.it

      Alias for test.

    • f
      test.it.only

      Shorthand for marking a test as only. This is the same as calling it with options.only set to true.

    • f
      test.it.skip

      Shorthand for skipping a test. This is the same as calling it with options.skip set to true.

    • f
      test.it.todo

      Shorthand for marking a test as TODO. This is the same as calling it with options.todo set to true.

    • f
      test.only

      Shorthand for marking a test as only. This is the same as calling test with options.only set to true.

    • f
      test.run

      Note: shard is used to horizontally parallelize test running across machines or processes, ideal for large-scale executions across varied environments. It's incompatible with watch mode, tailored for rapid code iteration by automatically rerunning tests on file changes.

    • f
      test.skip

      Shorthand for skipping a test. This is the same as calling test with options.skip set to true.

    • f
      test.snapshot.setDefaultSnapshotSerializers

      This function is used to customize the default serialization mechanism used by the test runner.

    • f
      test.snapshot.setResolveSnapshotPath

      This function is used to set a custom resolver for the location of the snapshot file used for snapshot testing. By default, the snapshot filename is the same as the entry point filename with .snapshot appended.

    • f
      N
      test.suite

      The suite() function is imported from the node:test module.

    • f
      test.suite.only

      Shorthand for marking a suite as only. This is the same as calling suite with options.only set to true.

    • f
      test.suite.skip

      Shorthand for skipping a suite. This is the same as calling suite with options.skip set to true.

    • f
      test.suite.todo

      Shorthand for marking a suite as TODO. This is the same as calling suite with options.todo set to true.

    • f
      test.todo

      Shorthand for marking a test as TODO. This is the same as calling test with options.todo set to true.

    • f
      todo

      Shorthand for marking a test as TODO. This is the same as calling test with options.todo set to true.

    • I
      AssertSnapshotOptions
    • I
      HookOptions

      Configuration options for hooks.

    • I
      MockFunctionCall
    • I
      MockFunctionOptions
    • I
      MockMethodOptions
    • I
      MockModuleOptions
    • I
      MockTimersOptions
    • I
      RunOptions
    • I
      TestContextAssert
    • I
      TestContextWaitForOptions
    • I
      TestOptions
    • I
      TestShard
    • N
      assert

      An object whose methods are used to configure available assertions on the TestContext objects in the current process. The methods from node:assert and snapshot testing functions are available by default.

    • N
      default.assert

      An object whose methods are used to configure available assertions on the TestContext objects in the current process. The methods from node:assert and snapshot testing functions are available by default.

    • N
      default.snapshot
    • N
      snapshot
    • N
      test.assert

      An object whose methods are used to configure available assertions on the TestContext objects in the current process. The methods from node:assert and snapshot testing functions are available by default.

    • N
      test.snapshot
    • T
      FunctionPropertyNames
    • T
      HookFn

      The hook function. The first argument is the context in which the hook is called. If the hook uses callbacks, the callback function is passed as the second argument.

    • T
      Mock
    • T
      NoOpFunction
    • T
      SuiteFn

      The type of a suite test function. The argument to this function is a SuiteContext object.

    • T
      TestContextHookFn

      The hook function. The first argument is a TestContext object. If the hook uses callbacks, the callback function is passed as the second argument.

    • T
      TestFn

      The type of a function passed to test. The first argument to this function is a TestContext object. If the test uses callbacks, the callback function is passed as the second argument.

    • T
      Timer
    • v
      default.mock
    • v
      mock
    • v
      test.mock

    node:test/reporters

    node:timers

    • f
      clearImmediate

      Cancels an Immediate object created by setImmediate().

    • f
      clearInterval

      Cancels a Timeout object created by setInterval().

    • f
      clearTimeout

      Cancels a Timeout object created by setTimeout().

    • f
      promises.setImmediate
    • f
      promises.setInterval

      Returns an async iterator that generates values in an interval of delay ms. If ref is true, you need to call next() of async iterator explicitly or implicitly to keep the event loop alive.

    • f
      promises.setTimeout
    • f
      queueMicrotask

      The queueMicrotask() method queues a microtask to invoke callback. If callback throws an exception, the process object 'uncaughtException' event will be emitted.

    • f
      N
      setImmediate

      Schedules the "immediate" execution of the callback after I/O events' callbacks.

    • f
      setImmediate.setImmediate
    • f
      setInterval

      Schedules repeated execution of callback every delay milliseconds.

    • f
      N
      setTimeout

      Schedules execution of a one-time callback after delay milliseconds.

    • f
      setTimeout.setTimeout
    • I
      Immediate

      This object is created internally and is returned from setImmediate(). It can be passed to clearImmediate() in order to cancel the scheduled actions.

    • I
      promises.Scheduler
    • I
      Timeout

      This object is created internally and is returned from setTimeout() and setInterval(). It can be passed to either clearTimeout() or clearInterval() in order to cancel the scheduled actions.

    • I
      TimerOptions
    • I
      Timer
    • N
      promises

      The timers/promises API provides an alternative set of timer functions that return Promise objects. The API is accessible via require('node:timers/promises').

    • v
      promises.scheduler

    node:timers/promises

    node:tls

    • c
      Server

      Accepts encrypted connections using TLS or SSL.

    • c
      TLSSocket

      Performs transparent encryption of written data and all required TLS negotiation.

    • f
      checkServerIdentity

      Verifies the certificate cert is issued to hostname.

    • f
      connect

      The callback function, if specified, will be added as a listener for the 'secureConnect' event.

    • f
      createSecureContext

      [createServer](/api/node/tls/ sets the default value of the honorCipherOrder option to true, other APIs that create secure contexts leave it unset.

    • f
      createServer

      Creates a new Server. The secureConnectionListener, if provided, is automatically set as a listener for the 'secureConnection' event.

    • f
      getCiphers

      Returns an array with the names of the supported TLS ciphers. The names are lower-case for historical reasons, but must be uppercased to be used in the ciphers option of [createSecureContext](/api/node/tls/.

    • f
      createSecurePair
    • I
      Certificate
    • I
      CipherNameAndProtocol
    • I
      CommonConnectionOptions
    • I
      ConnectionOptions
    • I
      DetailedPeerCertificate
    • I
      EphemeralKeyInfo
    • I
      KeyObject
    • I
      PeerCertificate
    • I
      PSKCallbackNegotation
    • I
      PxfObject
    • I
      SecureContext
    • I
      SecureContextOptions
    • I
      TlsOptions
    • I
      TLSSocketOptions
    • I
      SecurePair
    • T
      SecureVersion
    • v
      CLIENT_RENEG_LIMIT
    • v
      CLIENT_RENEG_WINDOW
    • v
      DEFAULT_CIPHERS

      The default value of the ciphers option of createSecureContext(). It can be assigned any of the supported OpenSSL ciphers. Defaults to the content of crypto.constants.defaultCoreCipherList, unless changed using CLI options using --tls-default-ciphers.

    • v
      DEFAULT_ECDH_CURVE

      The default curve name to use for ECDH key agreement in a tls server. The default value is 'auto'. See createSecureContext() for further information.

    • v
      DEFAULT_MAX_VERSION

      The default value of the maxVersion option of createSecureContext(). It can be assigned any of the supported TLS protocol versions, 'TLSv1.3', 'TLSv1.2', 'TLSv1.1', or 'TLSv1'. Default: 'TLSv1.3', unless changed using CLI options. Using --tls-max-v1.2 sets the default to 'TLSv1.2'. Using --tls-max-v1.3 sets the default to 'TLSv1.3'. If multiple of the options are provided, the highest maximum is used.

    • v
      DEFAULT_MIN_VERSION

      The default value of the minVersion option of createSecureContext(). It can be assigned any of the supported TLS protocol versions, 'TLSv1.3', 'TLSv1.2', 'TLSv1.1', or 'TLSv1'. Default: 'TLSv1.2', unless changed using CLI options. Using --tls-min-v1.0 sets the default to 'TLSv1'. Using --tls-min-v1.1 sets the default to 'TLSv1.1'. Using --tls-min-v1.3 sets the default to 'TLSv1.3'. If multiple of the options are provided, the lowest minimum is used.

    • v
      rootCertificates

      An immutable array of strings representing the root certificates (in PEM format) from the bundled Mozilla CA store as supplied by the current Node.js version.

    node:trace_events

    node:tty

    • c
      ReadStream

      Represents the readable side of a TTY. In normal circumstances process.stdin will be the only tty.ReadStream instance in a Node.js process and there should be no reason to create additional instances.

    • c
      WriteStream

      Represents the writable side of a TTY. In normal circumstances, process.stdout and process.stderr will be the onlytty.WriteStream instances created for a Node.js process and there should be no reason to create additional instances.

    • f
      isatty

      The tty.isatty() method returns true if the given fd is associated with a TTY and false if it is not, including whenever fd is not a non-negative integer.

    • T
      Direction

      -1 - to the left from cursor 0 - the entire line 1 - to the right from cursor

    node:url

    • c
      I
      v
      URL

      Browser-compatible URL class, implemented by following the WHATWG URL Standard. Examples of parsed URLs may be found in the Standard itself. The URL class is also available on the global object.

    • c
      I
      v
      URLSearchParams

      The URLSearchParams API provides read and write access to the query of a URL. The URLSearchParams class can also be used standalone with one of the four following constructors. The URLSearchParams class is also available on the global object.

    • f
      domainToASCII

      Returns the Punycode ASCII serialization of the domain. If domain is an invalid domain, the empty string is returned.

    • f
      domainToUnicode

      Returns the Unicode serialization of the domain. If domain is an invalid domain, the empty string is returned.

    • f
      fileURLToPath

      This function ensures the correct decodings of percent-encoded characters as well as ensuring a cross-platform valid absolute path string.

    • f
      format

      The url.format() method returns a formatted URL string derived from urlObject.

    • f
      parse
    • f
      pathToFileURL

      This function ensures that path is resolved absolutely, and that the URL control characters are correctly encoded when converting into a File URL.

    • f
      resolve

      The url.resolve() method resolves a target URL relative to a base URL in a manner similar to that of a web browser resolving an anchor tag.

    • f
      urlToHttpOptions

      This utility function converts a URL object into an ordinary options object as expected by the http.request() and https.request() APIs.

    • I
      FileUrlToPathOptions
    • I
      Global
    • I
      PathToFileUrlOptions
    • I
      Url
    • I
      URLFormatOptions
    • I
      UrlObject
    • I
      URLSearchParamsIterator
    • I
      UrlWithParsedQuery
    • I
      UrlWithStringQuery

    node:util

    node:util/types

    node:v8

    • c
      DefaultDeserializer

      A subclass of Deserializer corresponding to the format written by DefaultSerializer.

    • c
      DefaultSerializer

      A subclass of Serializer that serializes TypedArray(in particular Buffer) and DataView objects as host objects, and only stores the part of their underlying ArrayBuffers that they are referring to.

    • c
      Deserializer
    • c
      GCProfiler

      This API collects GC data in current thread.

    • c
      Serializer
    • f
      cachedDataVersionTag

      Returns an integer representing a version tag derived from the V8 version, command-line flags, and detected CPU features. This is useful for determining whether a vm.Script cachedData buffer is compatible with this instance of V8.

    • f
      deserialize

      Uses a DefaultDeserializer with default options to read a JS value from a buffer.

    • f
      getHeapCodeStatistics

      Get statistics about code and its metadata in the heap, see V8 GetHeapCodeAndMetadataStatistics API. Returns an object with the following properties:

    • f
      getHeapSnapshot

      Generates a snapshot of the current V8 heap and returns a Readable Stream that may be used to read the JSON serialized representation. This JSON stream format is intended to be used with tools such as Chrome DevTools. The JSON schema is undocumented and specific to the V8 engine. Therefore, the schema may change from one version of V8 to the next.

    • f
      getHeapSpaceStatistics

      Returns statistics about the V8 heap spaces, i.e. the segments which make up the V8 heap. Neither the ordering of heap spaces, nor the availability of a heap space can be guaranteed as the statistics are provided via the V8 GetHeapSpaceStatistics function and may change from one V8 version to the next.

    • f
      getHeapStatistics

      Returns an object with the following properties:

    • f
      queryObjects

      This is similar to the queryObjects() console API provided by the Chromium DevTools console. It can be used to search for objects that have the matching constructor on its prototype chain in the heap after a full garbage collection, which can be useful for memory leak regression tests. To avoid surprising results, users should avoid using this API on constructors whose implementation they don't control, or on constructors that can be invoked by other parties in the application.

    • f
      serialize

      Uses a DefaultSerializer to serialize value into a buffer.

    • f
      setFlagsFromString

      The v8.setFlagsFromString() method can be used to programmatically set V8 command-line flags. This method should be used with care. Changing settings after the VM has started may result in unpredictable behavior, including crashes and data loss; or it may simply do nothing.

    • f
      setHeapSnapshotNearHeapLimit

      The API is a no-op if --heapsnapshot-near-heap-limit is already set from the command line or the API is called more than once. limit must be a positive integer. See --heapsnapshot-near-heap-limit for more information.

    • f
      stopCoverage

      The v8.stopCoverage() method allows the user to stop the coverage collection started by NODE_V8_COVERAGE, so that V8 can release the execution count records and optimize code. This can be used in conjunction with takeCoverage if the user wants to collect the coverage on demand.

    • f
      takeCoverage

      The v8.takeCoverage() method allows the user to write the coverage started by NODE_V8_COVERAGE to disk on demand. This method can be invoked multiple times during the lifetime of the process. Each time the execution counter will be reset and a new coverage report will be written to the directory specified by NODE_V8_COVERAGE.

    • f
      writeHeapSnapshot

      Generates a snapshot of the current V8 heap and writes it to a JSON file. This file is intended to be used with tools such as Chrome DevTools. The JSON schema is undocumented and specific to the V8 engine, and may change from one version of V8 to the next.

    • I
      After

      Called immediately after a promise continuation executes. This may be after a then(), catch(), or finally() handler or before an await after another await.

    • I
      Before

      Called before a promise continuation executes. This can be in the form of then(), catch(), or finally() handlers or an await resuming.

    • I
      GCProfilerResult
    • I
      HeapCodeStatistics
    • I
      HeapInfo
    • I
      HeapSnapshotOptions
    • I
      HeapSpaceInfo
    • I
      HeapSpaceStatistics
    • I
      HeapStatistics
    • I
      HookCallbacks

      Key events in the lifetime of a promise have been categorized into four areas: creation of a promise, before/after a continuation handler is called or around an await, and when the promise resolves or rejects.

    • I
      Init

      Called when a promise is constructed. This does not mean that corresponding before/after events will occur, only that the possibility exists. This will happen if a promise is created without ever getting a continuation.

    • I
      PromiseHooks
    • I
      Settled

      Called when the promise receives a resolution or rejection value. This may occur synchronously in the case of Promise.resolve() or Promise.reject().

    • I
      StartupSnapshot
    • T
      DoesZapCodeSpaceFlag
    • T
      StartupSnapshotCallbackFn
    • v
      promiseHooks

      The promiseHooks interface can be used to track promise lifecycle events.

    • v
      startupSnapshot

      The v8.startupSnapshot interface can be used to add serialization and deserialization hooks for custom startup snapshots.

    node:vm

    node:wasi

    node:worker_threads

    node:zlib

    Did you find what you needed?

    Privacy policy