Package-level declarations
Types
The MIMEParams
API provides read and write access to the parameters of a MIMEType
.
An implementation of the MIMEType class.
Functions
Listens to abort event on the provided signal
and returns a promise that is fulfilled when the signal
is aborted. If the passed resource
is garbage collected before the signal
is aborted, the returned promise shall remain pending indefinitely.
Takes an async
function (or a function that returns a Promise
) and returns a function following the error-first callback style, i.e. taking an (err, value) => ...
callback as the last argument. In the callback, the first argument will be the rejection reason (or null
if the Promise
resolved), and the second argument will be the resolved value.
The util.debuglog()
method is used to create a function that conditionally writes debug messages to stderr
based on the existence of the NODE_DEBUG
environment variable. If the section
name appears within the value of that environment variable, then the returned function operates similar to console.error()
. If not, then the returned function is a no-op.
The util.format()
method returns a formatted string using the first argument as a printf
-like format string which can contain zero or more format specifiers. Each specifier is replaced with the converted value from the corresponding argument. Supported specifiers are:
This function is identical to {@link format}, except in that it takes an inspectOptions
argument which specifies options that are passed along to {@link inspect}.
Returns the string name for a numeric error code that comes from a Node.js API. The mapping between error codes and error names is platform-dependent. See Common System Errors
for the names of common errors.
Usage of util.inherits()
is discouraged. Please use the ES6 class
and extends
keywords to get language level inheritance support. Also note that the two styles are semantically incompatible.
The util.inspect()
method returns a string representation of object
that is intended for debugging. The output of util.inspect
may change at any time and should not be depended upon programmatically. Additional options
may be passed that alter the result. util.inspect()
will use the constructor's name and/or @@toStringTag
to make an identifiable tag for an inspected value.
Alias for Array.isArray()
.
Returns true
if the given object
is a Boolean
. Otherwise, returns false
.
Returns true
if the given object
is a Buffer
. Otherwise, returns false
.
Returns true
if there is deep strict equality between val1
and val2
. Otherwise, returns false
.
Returns true
if the given object
is an Error
. Otherwise, returns false
.
Returns true
if the given object
is a Function
. Otherwise, returns false
.
Returns true
if the given object
is null
or undefined
. Otherwise, returns false
.
Returns true
if the given object
is a Number
. Otherwise, returns false
.
Returns true
if the given object
is a primitive type. Otherwise, returnsfalse
.
Returns true
if the given object
is a RegExp
. Otherwise, returns false
.
Returns true
if the given object
is a string
. Otherwise, returns false
.
Returns true
if the given object
is a Symbol
. Otherwise, returns false
.
Returns true
if the given object
is undefined
. Otherwise, returns false
.
Provides a higher level API for command-line argument parsing than interacting with process.argv
directly. Takes a specification for the expected arguments and returns a structured object with the parsed options and positionals.
Takes a function following the common error-first callback style, i.e. taking an (err, value) => ...
callback as the last argument, and returns a version that returns promises.
Returns str
with any ANSI escape codes removed.
Stability: 1.1 - Active development
Returns the string
after replacing any surrogate code points (or equivalently, any unpaired surrogate code units) with the Unicode "replacement character" U+FFFD.
Creates and returns an AbortController
instance whose AbortSignal
is marked as transferable and can be used with structuredClone()
or postMessage()
.
Marks the given AbortSignal
as transferable so that it can be used withstructuredClone()
and postMessage()
.