* When an asynchronous operation is initiated or completes a callback is called to notify the user.
* The before callback is called just before said callback is executed.
* @param asyncId the unique identifier assigned to the resource about to execute the callback.
*/
before?(asyncId:number):void;
/**
* Called immediately after the callback specified in before is completed.
* @param asyncId the unique identifier assigned to the resource which has executed the callback.
*/
after?(asyncId:number):void;
/**
* Called when a promise has resolve() called. This may not be in the same execution id
* as the promise itself.
* @param asyncId the unique id for the promise that was resolve()d.
*/
promiseResolve?(asyncId:number):void;
/**
* Called after the resource corresponding to asyncId is destroyed
* @param asyncId a unique ID for the async resource
*/
destroy?(asyncId:number):void;
}
interfaceAsyncHook{
/**
* Enable the callbacks for a given AsyncHook instance. If no callbacks are provided enabling is a noop.
*/
enable():this;
/**
* Disable the callbacks for a given AsyncHook instance from the global pool of AsyncHook callbacks to be executed. Once a hook has been disabled it will not be called again until enabled.
*/
disable():this;
}
/**
* Registers functions to be called for different lifetime events of each async operation.
* @param options the callbacks to register
* @return an AsyncHooks instance used for disabling and enabling hooks
addListener(event:"message",listener:(message:any,handle:net.Socket|net.Server)=>void):this;// the handle is a net.Socket or net.Server object, or undefined.
prependListener(event:"message",listener:(message:any,handle:net.Socket|net.Server)=>void):this;// the handle is a net.Socket or net.Server object, or undefined.
prependOnceListener(event:"message",listener:(message:any,handle:net.Socket|net.Server)=>void):this;// the handle is a net.Socket or net.Server object, or undefined.
addListener(event:"message",listener:(worker:Worker,message:any,handle:net.Socket|net.Server)=>void):this;// the handle is a net.Socket or net.Server object, or undefined.
on(event:"message",listener:(worker:Worker,message:any,handle:net.Socket|net.Server)=>void):this;// the handle is a net.Socket or net.Server object, or undefined.
once(event:"message",listener:(worker:Worker,message:any,handle:net.Socket|net.Server)=>void):this;// the handle is a net.Socket or net.Server object, or undefined.
prependListener(event:"message",listener:(worker:Worker,message:any,handle:net.Socket|net.Server)=>void):this;// the handle is a net.Socket or net.Server object, or undefined.
functionon(event:"message",listener:(worker:Worker,message:any,handle:net.Socket|net.Server)=>void):Cluster;// the handle is a net.Socket or net.Server object, or undefined.
functiononce(event:"message",listener:(worker:Worker,message:any,handle:net.Socket|net.Server)=>void):Cluster;// the handle is a net.Socket or net.Server object, or undefined.
* When `stdout` is a TTY, calling `console.clear()` will attempt to clear the TTY.
* When `stdout` is not a TTY, this method does nothing.
*/
clear():void;
/**
* Maintains an internal counter specific to `label` and outputs to `stdout` the number of times `console.count()` has been called with the given `label`.
*/
count(label?:string):void;
/**
* Resets the internal counter specific to `label`.
*/
countReset(label?:string):void;
/**
* The `console.debug()` function is an alias for {@link console.log}.
*/
debug(message?:any,...optionalParams:any[]):void;
/**
* Uses {@link util.inspect} on `obj` and prints the resulting string to `stdout`.
* This function bypasses any custom `inspect()` function defined on `obj`.
*/
dir(obj:any,options?:InspectOptions):void;
/**
* This method calls {@link console.log} passing it the arguments received. Please note that this method does not produce any XML formatting
*/
dirxml(...data:any[]):void;
/**
* Prints to `stderr` with newline.
*/
error(message?:any,...optionalParams:any[]):void;
/**
* Increases indentation of subsequent lines by two spaces.
* If one or more `label`s are provided, those are printed first without the additional indentation.
*/
group(...label:any[]):void;
/**
* The `console.groupCollapsed()` function is an alias for {@link console.group}.
*/
groupCollapsed(...label:any[]):void;
/**
* Decreases indentation of subsequent lines by two spaces.
*/
groupEnd():void;
/**
* The {@link console.info} function is an alias for {@link console.log}.
*/
info(message?:any,...optionalParams:any[]):void;
/**
* Prints to `stdout` with newline.
*/
log(message?:any,...optionalParams:any[]):void;
/**
* This method does not display anything unless used in the inspector.
* Prints to `stdout` the array `array` formatted as a table.
/** Applies multiple bug workarounds within OpenSSL. See https://www.openssl.org/docs/man1.0.2/ssl/SSL_CTX_set_options.html for detail. */
constSSL_OP_ALL:number;
/** Allows legacy insecure renegotiation between OpenSSL and unpatched clients or servers. See https://www.openssl.org/docs/man1.0.2/ssl/SSL_CTX_set_options.html. */
/** Attempts to use the server's preferences instead of the client's when selecting a cipher. See https://www.openssl.org/docs/man1.0.2/ssl/SSL_CTX_set_options.html. */
constSSL_OP_CIPHER_SERVER_PREFERENCE:number;
/** Instructs OpenSSL to use Cisco's "speshul" version of DTLS_BAD_VER. */
constSSL_OP_CISCO_ANYCONNECT:number;
/** Instructs OpenSSL to turn on cookie exchange. */
constSSL_OP_COOKIE_EXCHANGE:number;
/** Instructs OpenSSL to add server-hello extension from an early version of the cryptopro draft. */
constSSL_OP_CRYPTOPRO_TLSEXT_BUG:number;
/** Instructs OpenSSL to disable a SSL 3.0/TLS 1.0 vulnerability workaround added in OpenSSL 0.9.6d. */
constSSL_OP_DONT_INSERT_EMPTY_FRAGMENTS:number;
/** Instructs OpenSSL to always use the tmp_rsa key when performing RSA operations. */
constSSL_OP_EPHEMERAL_RSA:number;
/** Allows initial connection to servers that do not support RI. */
constSSL_OP_LEGACY_SERVER_CONNECT:number;
constSSL_OP_MICROSOFT_BIG_SSLV3_BUFFER:number;
constSSL_OP_MICROSOFT_SESS_ID_BUG:number;
/** Instructs OpenSSL to disable the workaround for a man-in-the-middle protocol-version vulnerability in the SSL 2.0 server implementation. */
* Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`.
* @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
* @param options Either the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options.
* If `encoding` is not supplied, the default of `'utf8'` is used.
* If `persistent` is not supplied, the default of `true` is used.
* If `recursive` is not supplied, the default of `false` is used.
* Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`.
* @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
* @param options Either the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options.
* If `encoding` is not supplied, the default of `'utf8'` is used.
* If `persistent` is not supplied, the default of `true` is used.
* If `recursive` is not supplied, the default of `false` is used.
*/
exportfunctionwatch(
filename:PathLike,
options?:WatchOptions|BufferEncoding|null,
listener?:WatchListener<string>,
):FSWatcher;
/**
* Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`.
* @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
* @param options Either the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options.
* If `encoding` is not supplied, the default of `'utf8'` is used.
* If `persistent` is not supplied, the default of `true` is used.
* If `recursive` is not supplied, the default of `false` is used.
* Synchronously tests whether or not the given path exists by checking with the file system.
* @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
*/
exportfunctionexistsSync(path:PathLike):boolean;
exportnamespaceconstants{
// File Access Constants
/** Constant for fs.access(). File is visible to the calling process. */
constF_OK:number;
/** Constant for fs.access(). File can be read by the calling process. */
constR_OK:number;
/** Constant for fs.access(). File can be written by the calling process. */
constW_OK:number;
/** Constant for fs.access(). File can be executed by the calling process. */
constX_OK:number;
// File Copy Constants
/** Constant for fs.copyFile. Flag indicating the destination file should not be overwritten if it already exists. */
constCOPYFILE_EXCL:number;
/**
* 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.
*/
constCOPYFILE_FICLONE:number;
/**
* 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.
*/
constCOPYFILE_FICLONE_FORCE:number;
// File Open Constants
/** Constant for fs.open(). Flag indicating to open a file for read-only access. */
constO_RDONLY:number;
/** Constant for fs.open(). Flag indicating to open a file for write-only access. */
constO_WRONLY:number;
/** Constant for fs.open(). Flag indicating to open a file for read-write access. */
constO_RDWR:number;
/** Constant for fs.open(). Flag indicating to create the file if it does not already exist. */
constO_CREAT:number;
/** Constant for fs.open(). Flag indicating that opening a file should fail if the O_CREAT flag is set and the file already exists. */
constO_EXCL:number;
/**
* 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).
*/
constO_NOCTTY:number;
/** 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. */
constO_TRUNC:number;
/** Constant for fs.open(). Flag indicating that data will be appended to the end of the file. */
constO_APPEND:number;
/** Constant for fs.open(). Flag indicating that the open should fail if the path is not a directory. */
constO_DIRECTORY:number;
/**
* 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.
*/
constO_NOATIME:number;
/** Constant for fs.open(). Flag indicating that the open should fail if the path is a symbolic link. */
constO_NOFOLLOW:number;
/** Constant for fs.open(). Flag indicating that the file is opened for synchronous I/O. */
constO_SYNC:number;
/** Constant for fs.open(). Flag indicating that the file is opened for synchronous I/O with write operations waiting for data integrity. */
constO_DSYNC:number;
/** Constant for fs.open(). Flag indicating to open the symbolic link itself rather than the resource it is pointing to. */
constO_SYMLINK:number;
/** Constant for fs.open(). When set, an attempt will be made to minimize caching effects of file I/O. */
constO_DIRECT:number;
/** Constant for fs.open(). Flag indicating to open the file in nonblocking mode when possible. */
constO_NONBLOCK:number;
// File Type Constants
/** Constant for fs.Stats mode property for determining a file's type. Bit mask used to extract the file type code. */
constS_IFMT:number;
/** Constant for fs.Stats mode property for determining a file's type. File type constant for a regular file. */
constS_IFREG:number;
/** Constant for fs.Stats mode property for determining a file's type. File type constant for a directory. */
constS_IFDIR:number;
/** Constant for fs.Stats mode property for determining a file's type. File type constant for a character-oriented device file. */
constS_IFCHR:number;
/** Constant for fs.Stats mode property for determining a file's type. File type constant for a block-oriented device file. */
constS_IFBLK:number;
/** Constant for fs.Stats mode property for determining a file's type. File type constant for a FIFO/pipe. */
constS_IFIFO:number;
/** Constant for fs.Stats mode property for determining a file's type. File type constant for a symbolic link. */
constS_IFLNK:number;
/** Constant for fs.Stats mode property for determining a file's type. File type constant for a socket. */
constS_IFSOCK:number;
// File Mode Constants
/** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable, writable and executable by owner. */
constS_IRWXU:number;
/** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable by owner. */
constS_IRUSR:number;
/** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating writable by owner. */
constS_IWUSR:number;
/** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating executable by owner. */
constS_IXUSR:number;
/** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable, writable and executable by group. */
constS_IRWXG:number;
/** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable by group. */
constS_IRGRP:number;
/** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating writable by group. */
constS_IWGRP:number;
/** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating executable by group. */
constS_IXGRP:number;
/** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable, writable and executable by others. */
constS_IRWXO:number;
/** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable by others. */
constS_IROTH:number;
/** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating writable by others. */
constS_IWOTH:number;
/** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating executable by others. */
constS_IXOTH:number;
/**
* 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.
*/
constUV_FS_O_FILEMAP:number;
}
/**
* Asynchronously tests a user's permissions for the file specified by path.
* @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
* 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.
* @param src A path to the source file.
* @param dest A path to the destination file.
* @param flags An integer that specifies the behavior of the copy operation. The only supported flag is fs.constants.COPYFILE_EXCL, which causes the copy operation to fail if dest already exists.
* Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`.
* @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
* @param options Either the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options.
* If `encoding` is not supplied, the default of `'utf8'` is used.
* If `persistent` is not supplied, the default of `true` is used.
* If `recursive` is not supplied, the default of `false` is used.
* Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`.
* @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
* @param options Either the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options.
* If `encoding` is not supplied, the default of `'utf8'` is used.
* If `persistent` is not supplied, the default of `true` is used.
* If `recursive` is not supplied, the default of `false` is used.
*/
functionwatch(
filename:PathLike,
options?:WatchOptions|BufferEncoding
):AsyncIterable<string>;
/**
* Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`.
* @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
* @param options Either the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options.
* If `encoding` is not supplied, the default of `'utf8'` is used.
* If `persistent` is not supplied, the default of `true` is used.
* If `recursive` is not supplied, the default of `false` is used.
* Returns a buffer which is the result of concatenating all the buffers in the list together.
*
* If the list has no items, or if the totalLength is 0, then it returns a zero-length buffer.
* If the list has exactly one item, then the first item of the list is returned.
* If the list has more than one item, then a new Buffer is created.
*
* @param list An array of Buffer objects to concatenate
* @param totalLength Total length of the buffers when concatenated.
* If totalLength is not provided, it is read from the buffers in the list. However, this adds an additional loop to the function, so it is faster to provide the length explicitly.