diff --git a/src/Node.fs b/src/Node.fs index b9489cb8..3d8d2a33 100644 --- a/src/Node.fs +++ b/src/Node.fs @@ -400,6 +400,7 @@ module NodeJS = abstract cwd: unit -> string abstract emitWarning: warning: U2 * ?name: string * ?ctor: Function -> unit abstract env: ProcessEnv with get, set + abstract exit: ?code: float -> obj abstract exitCode: float with get, set abstract getgid: unit -> float abstract setgid: id: U2 -> unit @@ -2496,259 +2497,554 @@ module Fs = abstract Stats: StatsStatic abstract ReadStream: ReadStreamStatic abstract WriteStream: WriteStreamStatic - /// Asynchronous rename(2) - Change the name or location of a file or directory. + /// Asynchronous rename(2) - Change the name or location of a file or directory. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. + /// URL support is _experimental_. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. + /// URL support is _experimental_. abstract rename: oldPath: PathLike * newPath: PathLike * callback: (NodeJS.ErrnoException -> unit) -> unit - /// Synchronous rename(2) - Change the name or location of a file or directory. + /// Synchronous rename(2) - Change the name or location of a file or directory. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. + /// URL support is _experimental_. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. + /// URL support is _experimental_. abstract renameSync: oldPath: PathLike * newPath: PathLike -> unit - /// Asynchronous truncate(2) - Truncate a file to a specified length. + /// Asynchronous truncate(2) - Truncate a file to a specified length. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. + /// If not specified, defaults to `0`. abstract truncate: path: PathLike * len: float option * callback: (NodeJS.ErrnoException -> unit) -> unit - /// Asynchronous truncate(2) - Truncate a file to a specified length. + /// Asynchronous truncate(2) - Truncate a file to a specified length. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. + /// URL support is _experimental_. abstract truncate: path: PathLike * callback: (NodeJS.ErrnoException -> unit) -> unit - /// Synchronous truncate(2) - Truncate a file to a specified length. + /// Synchronous truncate(2) - Truncate a file to a specified length. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. + /// If not specified, defaults to `0`. abstract truncateSync: path: PathLike * ?len: float option -> unit - /// Asynchronous ftruncate(2) - Truncate a file to a specified length. + /// Asynchronous ftruncate(2) - Truncate a file to a specified length. + /// A file descriptor. + /// If not specified, defaults to `0`. abstract ftruncate: fd: float * len: float option * callback: (NodeJS.ErrnoException -> unit) -> unit - /// Asynchronous ftruncate(2) - Truncate a file to a specified length. + /// Asynchronous ftruncate(2) - Truncate a file to a specified length. + /// A file descriptor. abstract ftruncate: fd: float * callback: (NodeJS.ErrnoException -> unit) -> unit - /// Synchronous ftruncate(2) - Truncate a file to a specified length. + /// Synchronous ftruncate(2) - Truncate a file to a specified length. + /// A file descriptor. + /// If not specified, defaults to `0`. abstract ftruncateSync: fd: float * ?len: float option -> unit - /// Asynchronous chown(2) - Change ownership of a file. + /// Asynchronous chown(2) - Change ownership of a file. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. abstract chown: path: PathLike * uid: float * gid: float * callback: (NodeJS.ErrnoException -> unit) -> unit - /// Synchronous chown(2) - Change ownership of a file. + /// Synchronous chown(2) - Change ownership of a file. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. abstract chownSync: path: PathLike * uid: float * gid: float -> unit - /// Asynchronous fchown(2) - Change ownership of a file. + /// Asynchronous fchown(2) - Change ownership of a file. + /// A file descriptor. abstract fchown: fd: float * uid: float * gid: float * callback: (NodeJS.ErrnoException -> unit) -> unit - /// Synchronous fchown(2) - Change ownership of a file. + /// Synchronous fchown(2) - Change ownership of a file. + /// A file descriptor. abstract fchownSync: fd: float * uid: float * gid: float -> unit - /// Asynchronous lchown(2) - Change ownership of a file. Does not dereference symbolic links. + /// Asynchronous lchown(2) - Change ownership of a file. Does not dereference symbolic links. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. abstract lchown: path: PathLike * uid: float * gid: float * callback: (NodeJS.ErrnoException -> unit) -> unit - /// Synchronous lchown(2) - Change ownership of a file. Does not dereference symbolic links. + /// Synchronous lchown(2) - Change ownership of a file. Does not dereference symbolic links. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. abstract lchownSync: path: PathLike * uid: float * gid: float -> unit - /// Asynchronous chmod(2) - Change permissions of a file. + /// Asynchronous chmod(2) - Change permissions of a file. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. + /// A file mode. If a string is passed, it is parsed as an octal integer. abstract chmod: path: PathLike * mode: U2 * callback: (NodeJS.ErrnoException -> unit) -> unit - /// Synchronous chmod(2) - Change permissions of a file. + /// Synchronous chmod(2) - Change permissions of a file. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. + /// A file mode. If a string is passed, it is parsed as an octal integer. abstract chmodSync: path: PathLike * mode: U2 -> unit - /// Asynchronous fchmod(2) - Change permissions of a file. + /// Asynchronous fchmod(2) - Change permissions of a file. + /// A file descriptor. + /// A file mode. If a string is passed, it is parsed as an octal integer. abstract fchmod: fd: float * mode: U2 * callback: (NodeJS.ErrnoException -> unit) -> unit - /// Synchronous fchmod(2) - Change permissions of a file. + /// Synchronous fchmod(2) - Change permissions of a file. + /// A file descriptor. + /// A file mode. If a string is passed, it is parsed as an octal integer. abstract fchmodSync: fd: float * mode: U2 -> unit - /// Asynchronous lchmod(2) - Change permissions of a file. Does not dereference symbolic links. + /// Asynchronous lchmod(2) - Change permissions of a file. Does not dereference symbolic links. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. + /// A file mode. If a string is passed, it is parsed as an octal integer. abstract lchmod: path: PathLike * mode: U2 * callback: (NodeJS.ErrnoException -> unit) -> unit - /// Synchronous lchmod(2) - Change permissions of a file. Does not dereference symbolic links. + /// Synchronous lchmod(2) - Change permissions of a file. Does not dereference symbolic links. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. + /// A file mode. If a string is passed, it is parsed as an octal integer. abstract lchmodSync: path: PathLike * mode: U2 -> unit - /// Asynchronous stat(2) - Get file status. + /// Asynchronous stat(2) - Get file status. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. abstract stat: path: PathLike * callback: (NodeJS.ErrnoException -> Stats -> unit) -> unit - /// Synchronous stat(2) - Get file status. + /// Synchronous stat(2) - Get file status. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. abstract statSync: path: PathLike -> Stats - /// Asynchronous fstat(2) - Get file status. + /// Asynchronous fstat(2) - Get file status. + /// A file descriptor. abstract fstat: fd: float * callback: (NodeJS.ErrnoException -> Stats -> unit) -> unit - /// Synchronous fstat(2) - Get file status. + /// Synchronous fstat(2) - Get file status. + /// A file descriptor. abstract fstatSync: fd: float -> Stats - /// Asynchronous lstat(2) - Get file status. Does not dereference symbolic links. + /// Asynchronous lstat(2) - Get file status. Does not dereference symbolic links. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. abstract lstat: path: PathLike * callback: (NodeJS.ErrnoException -> Stats -> unit) -> unit - /// Synchronous lstat(2) - Get file status. Does not dereference symbolic links. + /// Synchronous lstat(2) - Get file status. Does not dereference symbolic links. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. abstract lstatSync: path: PathLike -> Stats - /// Asynchronous link(2) - Create a new link (also known as a hard link) to an existing file. + /// Asynchronous link(2) - Create a new link (also known as a hard link) to an existing file. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. abstract link: existingPath: PathLike * newPath: PathLike * callback: (NodeJS.ErrnoException -> unit) -> unit - /// Synchronous link(2) - Create a new link (also known as a hard link) to an existing file. + /// Synchronous link(2) - Create a new link (also known as a hard link) to an existing file. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. abstract linkSync: existingPath: PathLike * newPath: PathLike -> unit - /// Asynchronous symlink(2) - Create a new symbolic link to an existing file. + /// Asynchronous symlink(2) - Create a new symbolic link to an existing file. + /// A path to an existing file. If a URL is provided, it must use the `file:` protocol. + /// A path to the new symlink. If a URL is provided, it must use the `file:` protocol. + /// May be set to `'dir'`, `'file'`, or `'junction'` (default is `'file'`) and is only available on Windows (ignored on other platforms). + /// When using `'junction'`, the `target` argument will automatically be normalized to an absolute path. abstract symlink: target: PathLike * path: PathLike * ``type``: string option * callback: (NodeJS.ErrnoException -> unit) -> unit - /// Asynchronous symlink(2) - Create a new symbolic link to an existing file. + /// Asynchronous symlink(2) - Create a new symbolic link to an existing file. + /// A path to an existing file. If a URL is provided, it must use the `file:` protocol. + /// A path to the new symlink. If a URL is provided, it must use the `file:` protocol. abstract symlink: target: PathLike * path: PathLike * callback: (NodeJS.ErrnoException -> unit) -> unit - /// Synchronous symlink(2) - Create a new symbolic link to an existing file. + /// Synchronous symlink(2) - Create a new symbolic link to an existing file. + /// A path to an existing file. If a URL is provided, it must use the `file:` protocol. + /// A path to the new symlink. If a URL is provided, it must use the `file:` protocol. + /// May be set to `'dir'`, `'file'`, or `'junction'` (default is `'file'`) and is only available on Windows (ignored on other platforms). + /// When using `'junction'`, the `target` argument will automatically be normalized to an absolute path. abstract symlinkSync: target: PathLike * path: PathLike * ?``type``: string option -> unit - /// Asynchronous readlink(2) - read value of a symbolic link. + /// Asynchronous readlink(2) - read value of a symbolic link. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. + /// The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. abstract readlink: path: PathLike * options: U2 option * callback: (NodeJS.ErrnoException -> string -> unit) -> unit - /// Asynchronous readlink(2) - read value of a symbolic link. + /// Asynchronous readlink(2) - read value of a symbolic link. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. + /// The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. abstract readlink: path: PathLike * options: U2 * callback: (NodeJS.ErrnoException -> Buffer -> unit) -> unit - /// Asynchronous readlink(2) - read value of a symbolic link. + /// Asynchronous readlink(2) - read value of a symbolic link. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. + /// The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. abstract readlink: path: PathLike * options: U2 option * callback: (NodeJS.ErrnoException -> U2 -> unit) -> unit - /// Asynchronous readlink(2) - read value of a symbolic link. + /// Asynchronous readlink(2) - read value of a symbolic link. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. abstract readlink: path: PathLike * callback: (NodeJS.ErrnoException -> string -> unit) -> unit - /// Synchronous readlink(2) - read value of a symbolic link. + /// Synchronous readlink(2) - read value of a symbolic link. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. + /// The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. abstract readlinkSync: path: PathLike * ?options: U2 option -> string - /// Synchronous readlink(2) - read value of a symbolic link. + /// Synchronous readlink(2) - read value of a symbolic link. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. + /// The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. abstract readlinkSync: path: PathLike * options: U2 -> Buffer - /// Synchronous readlink(2) - read value of a symbolic link. + /// Synchronous readlink(2) - read value of a symbolic link. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. + /// The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. abstract readlinkSync: path: PathLike * ?options: U2 option -> U2 - /// Asynchronous realpath(3) - return the canonicalized absolute pathname. + /// Asynchronous realpath(3) - return the canonicalized absolute pathname. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. + /// The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. abstract realpath: path: PathLike * options: U2 option * callback: (NodeJS.ErrnoException -> string -> unit) -> unit - /// Asynchronous realpath(3) - return the canonicalized absolute pathname. + /// Asynchronous realpath(3) - return the canonicalized absolute pathname. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. + /// The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. abstract realpath: path: PathLike * options: U2 * callback: (NodeJS.ErrnoException -> Buffer -> unit) -> unit - /// Asynchronous realpath(3) - return the canonicalized absolute pathname. + /// Asynchronous realpath(3) - return the canonicalized absolute pathname. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. + /// The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. abstract realpath: path: PathLike * options: U2 option * callback: (NodeJS.ErrnoException -> U2 -> unit) -> unit - /// Asynchronous realpath(3) - return the canonicalized absolute pathname. + /// Asynchronous realpath(3) - return the canonicalized absolute pathname. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. abstract realpath: path: PathLike * callback: (NodeJS.ErrnoException -> string -> unit) -> unit - /// Synchronous realpath(3) - return the canonicalized absolute pathname. + /// Synchronous realpath(3) - return the canonicalized absolute pathname. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. + /// The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. abstract realpathSync: path: PathLike * ?options: U2 option -> string - /// Synchronous realpath(3) - return the canonicalized absolute pathname. + /// Synchronous realpath(3) - return the canonicalized absolute pathname. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. + /// The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. abstract realpathSync: path: PathLike * options: U2 -> Buffer - /// Synchronous realpath(3) - return the canonicalized absolute pathname. + /// Synchronous realpath(3) - return the canonicalized absolute pathname. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. + /// The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. abstract realpathSync: path: PathLike * ?options: U2 option -> U2 - /// Asynchronous unlink(2) - delete a name and possibly the file it refers to. + /// Asynchronous unlink(2) - delete a name and possibly the file it refers to. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. abstract unlink: path: PathLike * callback: (NodeJS.ErrnoException -> unit) -> unit - /// Synchronous unlink(2) - delete a name and possibly the file it refers to. + /// Synchronous unlink(2) - delete a name and possibly the file it refers to. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. abstract unlinkSync: path: PathLike -> unit - /// Asynchronous rmdir(2) - delete a directory. + /// Asynchronous rmdir(2) - delete a directory. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. abstract rmdir: path: PathLike * callback: (NodeJS.ErrnoException -> unit) -> unit - /// Synchronous rmdir(2) - delete a directory. + /// Synchronous rmdir(2) - delete a directory. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. abstract rmdirSync: path: PathLike -> unit - /// Asynchronous mkdir(2) - create a directory. + /// Asynchronous mkdir(2) - create a directory. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. + /// A file mode. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. abstract mkdir: path: PathLike * mode: U2 option * callback: (NodeJS.ErrnoException -> unit) -> unit - /// Asynchronous mkdir(2) - create a directory with a mode of `0o777`. + /// Asynchronous mkdir(2) - create a directory with a mode of `0o777`. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. abstract mkdir: path: PathLike * callback: (NodeJS.ErrnoException -> unit) -> unit - /// Synchronous mkdir(2) - create a directory. + /// Synchronous mkdir(2) - create a directory. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. + /// A file mode. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. abstract mkdirSync: path: PathLike * ?mode: U2 option -> unit - /// Asynchronously creates a unique temporary directory. - /// Generates six random characters to be appended behind a required prefix to create a unique temporary directory. + /// Asynchronously creates a unique temporary directory. + /// Generates six random characters to be appended behind a required prefix to create a unique temporary directory. + /// The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. abstract mkdtemp: prefix: string * options: U2 option * callback: (NodeJS.ErrnoException -> string -> unit) -> unit - /// Asynchronously creates a unique temporary directory. - /// Generates six random characters to be appended behind a required prefix to create a unique temporary directory. + /// Asynchronously creates a unique temporary directory. + /// Generates six random characters to be appended behind a required prefix to create a unique temporary directory. + /// The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. abstract mkdtemp: prefix: string * options: U2 * callback: (NodeJS.ErrnoException -> Buffer -> unit) -> unit - /// Asynchronously creates a unique temporary directory. - /// Generates six random characters to be appended behind a required prefix to create a unique temporary directory. + /// Asynchronously creates a unique temporary directory. + /// Generates six random characters to be appended behind a required prefix to create a unique temporary directory. + /// The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. abstract mkdtemp: prefix: string * options: U2 option * callback: (NodeJS.ErrnoException -> U2 -> unit) -> unit /// Asynchronously creates a unique temporary directory. /// Generates six random characters to be appended behind a required prefix to create a unique temporary directory. abstract mkdtemp: prefix: string * callback: (NodeJS.ErrnoException -> string -> unit) -> unit - /// Synchronously creates a unique temporary directory. - /// Generates six random characters to be appended behind a required prefix to create a unique temporary directory. + /// Synchronously creates a unique temporary directory. + /// Generates six random characters to be appended behind a required prefix to create a unique temporary directory. + /// The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. abstract mkdtempSync: prefix: string * ?options: U2 option -> string - /// Synchronously creates a unique temporary directory. - /// Generates six random characters to be appended behind a required prefix to create a unique temporary directory. + /// Synchronously creates a unique temporary directory. + /// Generates six random characters to be appended behind a required prefix to create a unique temporary directory. + /// The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. abstract mkdtempSync: prefix: string * options: U2 -> Buffer - /// Synchronously creates a unique temporary directory. - /// Generates six random characters to be appended behind a required prefix to create a unique temporary directory. + /// Synchronously creates a unique temporary directory. + /// Generates six random characters to be appended behind a required prefix to create a unique temporary directory. + /// The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. abstract mkdtempSync: prefix: string * ?options: U2 option -> U2 - /// Asynchronous readdir(3) - read a directory. + /// Asynchronous readdir(3) - read a directory. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. + /// The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. abstract readdir: path: PathLike * options: U2 option * callback: (NodeJS.ErrnoException -> ResizeArray -> unit) -> unit - /// Asynchronous readdir(3) - read a directory. + /// Asynchronous readdir(3) - read a directory. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. + /// The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. abstract readdir: path: PathLike * options: U2 * callback: (NodeJS.ErrnoException -> ResizeArray -> unit) -> unit - /// Asynchronous readdir(3) - read a directory. + /// Asynchronous readdir(3) - read a directory. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. + /// The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. abstract readdir: path: PathLike * options: U2 option * callback: (NodeJS.ErrnoException -> Array> -> unit) -> unit - /// Asynchronous readdir(3) - read a directory. + /// Asynchronous readdir(3) - read a directory. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. abstract readdir: path: PathLike * callback: (NodeJS.ErrnoException -> ResizeArray -> unit) -> unit - /// Synchronous readdir(3) - read a directory. + /// Synchronous readdir(3) - read a directory. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. + /// The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. abstract readdirSync: path: PathLike * ?options: U2 option -> ResizeArray - /// Synchronous readdir(3) - read a directory. + /// Synchronous readdir(3) - read a directory. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. + /// The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. abstract readdirSync: path: PathLike * options: U2 -> ResizeArray - /// Synchronous readdir(3) - read a directory. + /// Synchronous readdir(3) - read a directory. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. + /// The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. abstract readdirSync: path: PathLike * ?options: U2 option -> Array> - /// Asynchronous close(2) - close a file descriptor. + /// Asynchronous close(2) - close a file descriptor. + /// A file descriptor. abstract close: fd: float * callback: (NodeJS.ErrnoException -> unit) -> unit - /// Synchronous close(2) - close a file descriptor. + /// Synchronous close(2) - close a file descriptor. + /// A file descriptor. abstract closeSync: fd: float -> unit - /// Asynchronous open(2) - open and possibly create a file. + /// Asynchronous open(2) - open and possibly create a file. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. + /// A file mode. If a string is passed, it is parsed as an octal integer. If not supplied, defaults to `0o666`. abstract ``open``: path: PathLike * flags: U2 * mode: U2 option * callback: (NodeJS.ErrnoException -> float -> unit) -> unit - /// Asynchronous open(2) - open and possibly create a file. If the file is created, its mode will be `0o666`. + /// Asynchronous open(2) - open and possibly create a file. If the file is created, its mode will be `0o666`. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. abstract ``open``: path: PathLike * flags: U2 * callback: (NodeJS.ErrnoException -> float -> unit) -> unit - /// Synchronous open(2) - open and possibly create a file, returning a file descriptor.. + /// Synchronous open(2) - open and possibly create a file, returning a file descriptor.. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. + /// A file mode. If a string is passed, it is parsed as an octal integer. If not supplied, defaults to `0o666`. abstract openSync: path: PathLike * flags: U2 * ?mode: U2 option -> float - /// Asynchronously change file timestamps of the file referenced by the supplied path. + /// Asynchronously change file timestamps of the file referenced by the supplied path. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. + /// The last access time. If a string is provided, it will be coerced to number. + /// The last modified time. If a string is provided, it will be coerced to number. abstract utimes: path: PathLike * atime: U3 * mtime: U3 * callback: (NodeJS.ErrnoException -> unit) -> unit - /// Synchronously change file timestamps of the file referenced by the supplied path. + /// Synchronously change file timestamps of the file referenced by the supplied path. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. + /// The last access time. If a string is provided, it will be coerced to number. + /// The last modified time. If a string is provided, it will be coerced to number. abstract utimesSync: path: PathLike * atime: U3 * mtime: U3 -> unit - /// Asynchronously change file timestamps of the file referenced by the supplied file descriptor. + /// Asynchronously change file timestamps of the file referenced by the supplied file descriptor. + /// A file descriptor. + /// The last access time. If a string is provided, it will be coerced to number. + /// The last modified time. If a string is provided, it will be coerced to number. abstract futimes: fd: float * atime: U3 * mtime: U3 * callback: (NodeJS.ErrnoException -> unit) -> unit - /// Synchronously change file timestamps of the file referenced by the supplied file descriptor. + /// Synchronously change file timestamps of the file referenced by the supplied file descriptor. + /// A file descriptor. + /// The last access time. If a string is provided, it will be coerced to number. + /// The last modified time. If a string is provided, it will be coerced to number. abstract futimesSync: fd: float * atime: U3 * mtime: U3 -> unit - /// Asynchronous fsync(2) - synchronize a file's in-core state with the underlying storage device. + /// Asynchronous fsync(2) - synchronize a file's in-core state with the underlying storage device. + /// A file descriptor. abstract fsync: fd: float * callback: (NodeJS.ErrnoException -> unit) -> unit - /// Synchronous fsync(2) - synchronize a file's in-core state with the underlying storage device. + /// Synchronous fsync(2) - synchronize a file's in-core state with the underlying storage device. + /// A file descriptor. abstract fsyncSync: fd: float -> unit - /// Asynchronously writes `buffer` to the file referenced by the supplied file descriptor. + /// Asynchronously writes `buffer` to the file referenced by the supplied file descriptor. + /// A file descriptor. + /// The part of the buffer to be written. If not supplied, defaults to `0`. + /// The number of bytes to write. If not supplied, defaults to `buffer.length - offset`. + /// The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. abstract write: fd: float * buffer: 'TBuffer * offset: float option * length: float option * position: float option * callback: (NodeJS.ErrnoException -> float -> 'TBuffer -> unit) -> unit - /// Asynchronously writes `buffer` to the file referenced by the supplied file descriptor. + /// Asynchronously writes `buffer` to the file referenced by the supplied file descriptor. + /// A file descriptor. + /// The part of the buffer to be written. If not supplied, defaults to `0`. + /// The number of bytes to write. If not supplied, defaults to `buffer.length - offset`. abstract write: fd: float * buffer: 'TBuffer * offset: float option * length: float option * callback: (NodeJS.ErrnoException -> float -> 'TBuffer -> unit) -> unit - /// Asynchronously writes `buffer` to the file referenced by the supplied file descriptor. + /// Asynchronously writes `buffer` to the file referenced by the supplied file descriptor. + /// A file descriptor. + /// The part of the buffer to be written. If not supplied, defaults to `0`. abstract write: fd: float * buffer: 'TBuffer * offset: float option * callback: (NodeJS.ErrnoException -> float -> 'TBuffer -> unit) -> unit - /// Asynchronously writes `buffer` to the file referenced by the supplied file descriptor. + /// Asynchronously writes `buffer` to the file referenced by the supplied file descriptor. + /// A file descriptor. abstract write: fd: float * buffer: 'TBuffer * callback: (NodeJS.ErrnoException -> float -> 'TBuffer -> unit) -> unit - /// Asynchronously writes `string` to the file referenced by the supplied file descriptor. + /// Asynchronously writes `string` to the file referenced by the supplied file descriptor. + /// A file descriptor. + /// A string to write. If something other than a string is supplied it will be coerced to a string. + /// The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. + /// The expected string encoding. abstract write: fd: float * string: obj option * position: float option * encoding: string option * callback: (NodeJS.ErrnoException -> float -> string -> unit) -> unit - /// Asynchronously writes `string` to the file referenced by the supplied file descriptor. + /// Asynchronously writes `string` to the file referenced by the supplied file descriptor. + /// A file descriptor. + /// A string to write. If something other than a string is supplied it will be coerced to a string. + /// The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. abstract write: fd: float * string: obj option * position: float option * callback: (NodeJS.ErrnoException -> float -> string -> unit) -> unit - /// Asynchronously writes `string` to the file referenced by the supplied file descriptor. + /// Asynchronously writes `string` to the file referenced by the supplied file descriptor. + /// A file descriptor. + /// A string to write. If something other than a string is supplied it will be coerced to a string. abstract write: fd: float * string: obj option * callback: (NodeJS.ErrnoException -> float -> string -> unit) -> unit - /// Synchronously writes `buffer` to the file referenced by the supplied file descriptor, returning the number of bytes written. + /// Synchronously writes `buffer` to the file referenced by the supplied file descriptor, returning the number of bytes written. + /// A file descriptor. + /// The part of the buffer to be written. If not supplied, defaults to `0`. + /// The number of bytes to write. If not supplied, defaults to `buffer.length - offset`. + /// The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. abstract writeSync: fd: float * buffer: U2 * ?offset: float option * ?length: float option * ?position: float option -> float - /// Synchronously writes `string` to the file referenced by the supplied file descriptor, returning the number of bytes written. + /// Synchronously writes `string` to the file referenced by the supplied file descriptor, returning the number of bytes written. + /// A file descriptor. + /// A string to write. If something other than a string is supplied it will be coerced to a string. + /// The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. + /// The expected string encoding. abstract writeSync: fd: float * string: obj option * ?position: float option * ?encoding: string option -> float - /// Asynchronously reads data from the file referenced by the supplied file descriptor. + /// Asynchronously reads data from the file referenced by the supplied file descriptor. + /// A file descriptor. + /// The buffer that the data will be written to. + /// The offset in the buffer at which to start writing. + /// The number of bytes to read. + /// The offset from the beginning of the file from which data should be read. If `null`, data will be read from the current position. abstract read: fd: float * buffer: 'TBuffer * offset: float * length: float * position: float option * ?callback: (NodeJS.ErrnoException -> float -> 'TBuffer -> unit) -> unit - /// Synchronously reads data from the file referenced by the supplied file descriptor, returning the number of bytes read. + /// Synchronously reads data from the file referenced by the supplied file descriptor, returning the number of bytes read. + /// A file descriptor. + /// The buffer that the data will be written to. + /// The offset in the buffer at which to start writing. + /// The number of bytes to read. + /// The offset from the beginning of the file from which data should be read. If `null`, data will be read from the current position. abstract readSync: fd: float * buffer: U2 * offset: float * length: float * position: float option -> float - /// Asynchronously reads the entire contents of a file. + /// Asynchronously reads the entire contents of a file. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. + /// If a file descriptor is provided, the underlying file will _not_ be closed automatically. + /// An object that may contain an optional flag. + /// If a flag is not provided, it defaults to `'r'`. + abstract readFile: path: U2 * options: obj option * callback: (NodeJS.ErrnoException -> Buffer -> unit) -> unit + /// Asynchronously reads the entire contents of a file. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. + /// URL support is _experimental_. + /// If a file descriptor is provided, the underlying file will _not_ be closed automatically. + /// Either the encoding for the result, or an object that contains the encoding and an optional flag. + /// If a flag is not provided, it defaults to `'r'`. abstract readFile: path: U2 * options: U2 * callback: (NodeJS.ErrnoException -> string -> unit) -> unit - /// Asynchronously reads the entire contents of a file. + /// Asynchronously reads the entire contents of a file. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. + /// URL support is _experimental_. + /// If a file descriptor is provided, the underlying file will _not_ be closed automatically. + /// Either the encoding for the result, or an object that contains the encoding and an optional flag. + /// If a flag is not provided, it defaults to `'r'`. abstract readFile: path: U2 * options: U2 option * callback: (NodeJS.ErrnoException -> U2 -> unit) -> unit - /// Asynchronously reads the entire contents of a file. + /// Asynchronously reads the entire contents of a file. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. + /// If a file descriptor is provided, the underlying file will _not_ be closed automatically. abstract readFile: path: U2 * callback: (NodeJS.ErrnoException -> Buffer -> unit) -> unit - /// Synchronously reads the entire contents of a file. + /// Synchronously reads the entire contents of a file. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. + /// URL support is _experimental_. + /// If a file descriptor is provided, the underlying file will _not_ be closed automatically. + /// An object that may contain an optional flag. If a flag is not provided, it defaults to `'r'`. + abstract readFileSync: path: U2 * ?options: obj option -> Buffer + /// Synchronously reads the entire contents of a file. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. + /// URL support is _experimental_. + /// If a file descriptor is provided, the underlying file will _not_ be closed automatically. + /// Either the encoding for the result, or an object that contains the encoding and an optional flag. + /// If a flag is not provided, it defaults to `'r'`. abstract readFileSync: path: U2 * options: U2 -> string - /// Synchronously reads the entire contents of a file. + /// Synchronously reads the entire contents of a file. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. + /// URL support is _experimental_. + /// If a file descriptor is provided, the underlying file will _not_ be closed automatically. + /// Either the encoding for the result, or an object that contains the encoding and an optional flag. + /// If a flag is not provided, it defaults to `'r'`. abstract readFileSync: path: U2 * ?options: U2 option -> U2 - /// Asynchronously writes data to a file, replacing the file if it already exists. + /// Asynchronously writes data to a file, replacing the file if it already exists. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. + /// URL support is _experimental_. + /// If a file descriptor is provided, the underlying file will _not_ be closed automatically. + /// The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string. + /// Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag. + /// If `encoding` is not supplied, the default of `'utf8'` is used. + /// If `mode` is not supplied, the default of `0o666` is used. + /// If `mode` is a string, it is parsed as an octal integer. + /// If `flag` is not supplied, the default of `'w'` is used. abstract writeFile: path: U2 * data: obj option * options: U2 option * callback: (NodeJS.ErrnoException -> unit) -> unit - /// Asynchronously writes data to a file, replacing the file if it already exists. + /// Asynchronously writes data to a file, replacing the file if it already exists. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. + /// URL support is _experimental_. + /// If a file descriptor is provided, the underlying file will _not_ be closed automatically. + /// The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string. abstract writeFile: path: U2 * data: obj option * callback: (NodeJS.ErrnoException -> unit) -> unit - /// Synchronously writes data to a file, replacing the file if it already exists. + /// Synchronously writes data to a file, replacing the file if it already exists. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. + /// URL support is _experimental_. + /// If a file descriptor is provided, the underlying file will _not_ be closed automatically. + /// The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string. + /// Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag. + /// If `encoding` is not supplied, the default of `'utf8'` is used. + /// If `mode` is not supplied, the default of `0o666` is used. + /// If `mode` is a string, it is parsed as an octal integer. + /// If `flag` is not supplied, the default of `'w'` is used. abstract writeFileSync: path: U2 * data: obj option * ?options: U2 option -> unit - /// Asynchronously append data to a file, creating the file if it does not exist. + /// Asynchronously append data to a file, creating the file if it does not exist. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. + /// URL support is _experimental_. + /// If a file descriptor is provided, the underlying file will _not_ be closed automatically. + /// The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string. + /// Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag. + /// If `encoding` is not supplied, the default of `'utf8'` is used. + /// If `mode` is not supplied, the default of `0o666` is used. + /// If `mode` is a string, it is parsed as an octal integer. + /// If `flag` is not supplied, the default of `'a'` is used. abstract appendFile: file: U2 * data: obj option * options: U2 option * callback: (NodeJS.ErrnoException -> unit) -> unit - /// Asynchronously append data to a file, creating the file if it does not exist. + /// Asynchronously append data to a file, creating the file if it does not exist. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. + /// URL support is _experimental_. + /// If a file descriptor is provided, the underlying file will _not_ be closed automatically. + /// The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string. abstract appendFile: file: U2 * data: obj option * callback: (NodeJS.ErrnoException -> unit) -> unit - /// Synchronously append data to a file, creating the file if it does not exist. + /// Synchronously append data to a file, creating the file if it does not exist. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. + /// URL support is _experimental_. + /// If a file descriptor is provided, the underlying file will _not_ be closed automatically. + /// The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string. + /// Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag. + /// If `encoding` is not supplied, the default of `'utf8'` is used. + /// If `mode` is not supplied, the default of `0o666` is used. + /// If `mode` is a string, it is parsed as an octal integer. + /// If `flag` is not supplied, the default of `'a'` is used. abstract appendFileSync: file: U2 * data: obj option * ?options: U2 option -> unit /// Watch for changes on `filename`. The callback `listener` will be called each time the file is accessed. abstract watchFile: filename: PathLike * options: obj option * listener: (Stats -> Stats -> unit) -> unit - /// Watch for changes on `filename`. The callback `listener` will be called each time the file is accessed. + /// Watch for changes on `filename`. The callback `listener` will be called each time the file is accessed. + /// A path to a file or directory. If a URL is provided, it must use the `file:` protocol. + /// URL support is _experimental_. abstract watchFile: filename: PathLike * listener: (Stats -> Stats -> unit) -> unit - /// Stop watching for changes on `filename`. + /// Stop watching for changes on `filename`. + /// A path to a file or directory. If a URL is provided, it must use the `file:` protocol. + /// URL support is _experimental_. abstract unwatchFile: filename: PathLike * ?listener: (Stats -> Stats -> unit) -> unit - /// Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`. + /// Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`. + /// A path to a file or directory. If a URL is provided, it must use the `file:` protocol. + /// URL support is _experimental_. + /// 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. abstract watch: filename: PathLike * options: U2 option * ?listener: (string -> string -> unit) -> FSWatcher - /// Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`. + /// Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`. + /// A path to a file or directory. If a URL is provided, it must use the `file:` protocol. + /// URL support is _experimental_. + /// 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. abstract watch: filename: PathLike * options: U2 * ?listener: (string -> Buffer -> unit) -> FSWatcher - /// Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`. + /// Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`. + /// A path to a file or directory. If a URL is provided, it must use the `file:` protocol. + /// URL support is _experimental_. + /// 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. abstract watch: filename: PathLike * options: U2 option * ?listener: (string -> U2 -> unit) -> FSWatcher - /// Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`. + /// Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`. + /// A path to a file or directory. If a URL is provided, it must use the `file:` protocol. + /// URL support is _experimental_. abstract watch: filename: PathLike * ?listener: (string -> string -> obj option) -> FSWatcher - /// Asynchronously tests whether or not the given path exists by checking with the file system. + /// Asynchronously tests whether or not the given path exists by checking with the file system. + /// A path to a file or directory. If a URL is provided, it must use the `file:` protocol. + /// URL support is _experimental_. abstract exists: path: PathLike * callback: (bool -> unit) -> unit - /// Synchronously tests whether or not the given path exists by checking with the file system. + /// Synchronously tests whether or not the given path exists by checking with the file system. + /// A path to a file or directory. If a URL is provided, it must use the `file:` protocol. + /// URL support is _experimental_. abstract existsSync: path: PathLike -> bool - /// Asynchronously tests a user's permissions for the file specified by path. + /// Asynchronously tests a user's permissions for the file specified by path. + /// A path to a file or directory. If a URL is provided, it must use the `file:` protocol. + /// URL support is _experimental_. abstract access: path: PathLike * mode: float option * callback: (NodeJS.ErrnoException -> unit) -> unit - /// Asynchronously tests a user's permissions for the file specified by path. + /// Asynchronously tests a user's permissions for the file specified by path. + /// A path to a file or directory. If a URL is provided, it must use the `file:` protocol. + /// URL support is _experimental_. abstract access: path: PathLike * callback: (NodeJS.ErrnoException -> unit) -> unit - /// Synchronously tests a user's permissions for the file specified by path. + /// Synchronously tests a user's permissions for the file specified by path. + /// A path to a file or directory. If a URL is provided, it must use the `file:` protocol. + /// URL support is _experimental_. abstract accessSync: path: PathLike * ?mode: float -> unit - /// Returns a new `ReadStream` object. + /// Returns a new `ReadStream` object. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. + /// URL support is _experimental_. abstract createReadStream: path: PathLike * ?options: U2 -> ReadStream - /// Returns a new `WriteStream` object. + /// Returns a new `WriteStream` object. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. + /// URL support is _experimental_. abstract createWriteStream: path: PathLike * ?options: U2 -> WriteStream - /// Asynchronous fdatasync(2) - synchronize a file's in-core state with storage device. + /// Asynchronous fdatasync(2) - synchronize a file's in-core state with storage device. + /// A file descriptor. abstract fdatasync: fd: float * callback: (NodeJS.ErrnoException -> unit) -> unit - /// Synchronous fdatasync(2) - synchronize a file's in-core state with storage device. + /// Synchronous fdatasync(2) - synchronize a file's in-core state with storage device. + /// A file descriptor. abstract fdatasyncSync: fd: float -> unit - /// Asynchronously copies src to dest. By default, dest is overwritten if it already exists. + /// 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. + /// to remove the destination. + /// A path to the source file. + /// A path to the destination file. abstract copyFile: src: PathLike * dest: PathLike * callback: (NodeJS.ErrnoException -> unit) -> unit - /// Asynchronously copies src to dest. By default, dest is overwritten if it already exists. + /// 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. + /// to remove the destination. + /// A path to the source file. + /// A path to the destination file. + /// 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. abstract copyFile: src: PathLike * dest: PathLike * flags: float * callback: (NodeJS.ErrnoException -> unit) -> unit - /// Synchronously copies src to dest. By default, dest is overwritten if it already exists. + /// Synchronously copies src to dest. By default, dest is overwritten if it already exists. /// 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. + /// to remove the destination. + /// A path to the source file. + /// A path to the destination file. + /// An optional 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. abstract copyFileSync: src: PathLike * dest: PathLike * ?flags: float -> unit type PathLike = @@ -2876,214 +3172,324 @@ module Fs = module Rename = type [] IExports = - /// Asynchronous rename(2) - Change the name or location of a file or directory. + /// Asynchronous rename(2) - Change the name or location of a file or directory. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. + /// URL support is _experimental_. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. + /// URL support is _experimental_. abstract __promisify__: oldPath: PathLike * newPath: PathLike -> Promise module Truncate = type [] IExports = - /// Asynchronous truncate(2) - Truncate a file to a specified length. + /// Asynchronous truncate(2) - Truncate a file to a specified length. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. + /// If not specified, defaults to `0`. abstract __promisify__: path: PathLike * ?len: float option -> Promise module Ftruncate = type [] IExports = - /// Asynchronous ftruncate(2) - Truncate a file to a specified length. + /// Asynchronous ftruncate(2) - Truncate a file to a specified length. + /// A file descriptor. + /// If not specified, defaults to `0`. abstract __promisify__: fd: float * ?len: float option -> Promise module Chown = type [] IExports = - /// Asynchronous chown(2) - Change ownership of a file. + /// Asynchronous chown(2) - Change ownership of a file. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. abstract __promisify__: path: PathLike * uid: float * gid: float -> Promise module Fchown = type [] IExports = - /// Asynchronous fchown(2) - Change ownership of a file. + /// Asynchronous fchown(2) - Change ownership of a file. + /// A file descriptor. abstract __promisify__: fd: float * uid: float * gid: float -> Promise module Lchown = type [] IExports = - /// Asynchronous lchown(2) - Change ownership of a file. Does not dereference symbolic links. + /// Asynchronous lchown(2) - Change ownership of a file. Does not dereference symbolic links. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. abstract __promisify__: path: PathLike * uid: float * gid: float -> Promise module Chmod = type [] IExports = - /// Asynchronous chmod(2) - Change permissions of a file. + /// Asynchronous chmod(2) - Change permissions of a file. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. + /// A file mode. If a string is passed, it is parsed as an octal integer. abstract __promisify__: path: PathLike * mode: U2 -> Promise module Fchmod = type [] IExports = - /// Asynchronous fchmod(2) - Change permissions of a file. + /// Asynchronous fchmod(2) - Change permissions of a file. + /// A file descriptor. + /// A file mode. If a string is passed, it is parsed as an octal integer. abstract __promisify__: fd: float * mode: U2 -> Promise module Lchmod = type [] IExports = - /// Asynchronous lchmod(2) - Change permissions of a file. Does not dereference symbolic links. + /// Asynchronous lchmod(2) - Change permissions of a file. Does not dereference symbolic links. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. + /// A file mode. If a string is passed, it is parsed as an octal integer. abstract __promisify__: path: PathLike * mode: U2 -> Promise module Stat = type [] IExports = - /// Asynchronous stat(2) - Get file status. + /// Asynchronous stat(2) - Get file status. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. abstract __promisify__: path: PathLike -> Promise module Fstat = type [] IExports = - /// Asynchronous fstat(2) - Get file status. + /// Asynchronous fstat(2) - Get file status. + /// A file descriptor. abstract __promisify__: fd: float -> Promise module Lstat = type [] IExports = - /// Asynchronous lstat(2) - Get file status. Does not dereference symbolic links. + /// Asynchronous lstat(2) - Get file status. Does not dereference symbolic links. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. abstract __promisify__: path: PathLike -> Promise module Link = type [] IExports = - /// Asynchronous link(2) - Create a new link (also known as a hard link) to an existing file. + /// Asynchronous link(2) - Create a new link (also known as a hard link) to an existing file. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. abstract link: existingPath: PathLike * newPath: PathLike -> Promise module Symlink = type [] IExports = - /// Asynchronous symlink(2) - Create a new symbolic link to an existing file. + /// Asynchronous symlink(2) - Create a new symbolic link to an existing file. + /// A path to an existing file. If a URL is provided, it must use the `file:` protocol. + /// A path to the new symlink. If a URL is provided, it must use the `file:` protocol. + /// May be set to `'dir'`, `'file'`, or `'junction'` (default is `'file'`) and is only available on Windows (ignored on other platforms). + /// When using `'junction'`, the `target` argument will automatically be normalized to an absolute path. abstract __promisify__: target: PathLike * path: PathLike * ?``type``: string option -> Promise module Readlink = type [] IExports = - /// Asynchronous readlink(2) - read value of a symbolic link. + /// Asynchronous readlink(2) - read value of a symbolic link. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. + /// The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. abstract __promisify__: path: PathLike * ?options: U2 option -> Promise - /// Asynchronous readlink(2) - read value of a symbolic link. + /// Asynchronous readlink(2) - read value of a symbolic link. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. + /// The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. abstract __promisify__: path: PathLike * options: U2 -> Promise - /// Asynchronous readlink(2) - read value of a symbolic link. + /// Asynchronous readlink(2) - read value of a symbolic link. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. + /// The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. abstract __promisify__: path: PathLike * ?options: U2 option -> Promise> module Realpath = type [] IExports = - /// Asynchronous realpath(3) - return the canonicalized absolute pathname. + /// Asynchronous realpath(3) - return the canonicalized absolute pathname. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. + /// The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. abstract __promisify__: path: PathLike * ?options: U2 option -> Promise - /// Asynchronous realpath(3) - return the canonicalized absolute pathname. + /// Asynchronous realpath(3) - return the canonicalized absolute pathname. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. + /// The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. abstract __promisify__: path: PathLike * options: U2 -> Promise - /// Asynchronous realpath(3) - return the canonicalized absolute pathname. + /// Asynchronous realpath(3) - return the canonicalized absolute pathname. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. + /// The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. abstract __promisify__: path: PathLike * ?options: U2 option -> Promise> module Unlink = type [] IExports = - /// Asynchronous unlink(2) - delete a name and possibly the file it refers to. + /// Asynchronous unlink(2) - delete a name and possibly the file it refers to. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. abstract __promisify__: path: PathLike -> Promise module Rmdir = type [] IExports = - /// Asynchronous rmdir(2) - delete a directory. + /// Asynchronous rmdir(2) - delete a directory. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. abstract __promisify__: path: PathLike -> Promise module Mkdir = type [] IExports = - /// Asynchronous mkdir(2) - create a directory. + /// Asynchronous mkdir(2) - create a directory. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. + /// A file mode. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. abstract __promisify__: path: PathLike * ?mode: U2 option -> Promise module Mkdtemp = type [] IExports = - /// Asynchronously creates a unique temporary directory. - /// Generates six random characters to be appended behind a required prefix to create a unique temporary directory. + /// Asynchronously creates a unique temporary directory. + /// Generates six random characters to be appended behind a required prefix to create a unique temporary directory. + /// The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. abstract __promisify__: prefix: string * ?options: U2 option -> Promise - /// Asynchronously creates a unique temporary directory. - /// Generates six random characters to be appended behind a required prefix to create a unique temporary directory. + /// Asynchronously creates a unique temporary directory. + /// Generates six random characters to be appended behind a required prefix to create a unique temporary directory. + /// The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. abstract __promisify__: prefix: string * options: U2 -> Promise - /// Asynchronously creates a unique temporary directory. - /// Generates six random characters to be appended behind a required prefix to create a unique temporary directory. + /// Asynchronously creates a unique temporary directory. + /// Generates six random characters to be appended behind a required prefix to create a unique temporary directory. + /// The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. abstract __promisify__: prefix: string * ?options: U2 option -> Promise> module Readdir = type [] IExports = - /// Asynchronous readdir(3) - read a directory. + /// Asynchronous readdir(3) - read a directory. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. + /// The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. abstract __promisify__: path: PathLike * ?options: U2 option -> Promise> - /// Asynchronous readdir(3) - read a directory. + /// Asynchronous readdir(3) - read a directory. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. + /// The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. abstract __promisify__: path: PathLike * options: U2 -> Promise> - /// Asynchronous readdir(3) - read a directory. + /// Asynchronous readdir(3) - read a directory. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. + /// The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. abstract __promisify__: path: PathLike * ?options: U2 option -> Promise>> module Close = type [] IExports = - /// Asynchronous close(2) - close a file descriptor. + /// Asynchronous close(2) - close a file descriptor. + /// A file descriptor. abstract __promisify__: fd: float -> Promise module Open = type [] IExports = - /// Asynchronous open(2) - open and possibly create a file. + /// Asynchronous open(2) - open and possibly create a file. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. + /// A file mode. If a string is passed, it is parsed as an octal integer. If not supplied, defaults to `0o666`. abstract __promisify__: path: PathLike * flags: U2 * ?mode: U2 option -> Promise module Utimes = type [] IExports = - /// Asynchronously change file timestamps of the file referenced by the supplied path. + /// Asynchronously change file timestamps of the file referenced by the supplied path. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. + /// The last access time. If a string is provided, it will be coerced to number. + /// The last modified time. If a string is provided, it will be coerced to number. abstract __promisify__: path: PathLike * atime: U3 * mtime: U3 -> Promise module Futimes = type [] IExports = - /// Asynchronously change file timestamps of the file referenced by the supplied file descriptor. + /// Asynchronously change file timestamps of the file referenced by the supplied file descriptor. + /// A file descriptor. + /// The last access time. If a string is provided, it will be coerced to number. + /// The last modified time. If a string is provided, it will be coerced to number. abstract __promisify__: fd: float * atime: U3 * mtime: U3 -> Promise module Fsync = type [] IExports = - /// Asynchronous fsync(2) - synchronize a file's in-core state with the underlying storage device. + /// Asynchronous fsync(2) - synchronize a file's in-core state with the underlying storage device. + /// A file descriptor. abstract __promisify__: fd: float -> Promise module Write = type [] IExports = - /// Asynchronously writes `buffer` to the file referenced by the supplied file descriptor. + /// Asynchronously writes `buffer` to the file referenced by the supplied file descriptor. + /// A file descriptor. + /// The part of the buffer to be written. If not supplied, defaults to `0`. + /// The number of bytes to write. If not supplied, defaults to `buffer.length - offset`. + /// The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. abstract __promisify__: fd: float * ?buffer: 'TBuffer * ?offset: float * ?length: float * ?position: float option -> Promise - /// Asynchronously writes `string` to the file referenced by the supplied file descriptor. + /// Asynchronously writes `string` to the file referenced by the supplied file descriptor. + /// A file descriptor. + /// A string to write. If something other than a string is supplied it will be coerced to a string. + /// The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. + /// The expected string encoding. abstract __promisify__: fd: float * string: obj option * ?position: float option * ?encoding: string option -> Promise module Read = type [] IExports = + /// A file descriptor. + /// The buffer that the data will be written to. + /// The offset in the buffer at which to start writing. + /// The number of bytes to read. + /// The offset from the beginning of the file from which data should be read. If `null`, data will be read from the current position. abstract __promisify__: fd: float * buffer: 'TBuffer * offset: float * length: float * position: float option -> Promise module ReadFile = type [] IExports = - /// Asynchronously reads the entire contents of a file. + /// Asynchronously reads the entire contents of a file. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. + /// If a file descriptor is provided, the underlying file will _not_ be closed automatically. + /// An object that may contain an optional flag. + /// If a flag is not provided, it defaults to `'r'`. + abstract __promisify__: path: U2 * ?options: obj option -> Promise + /// Asynchronously reads the entire contents of a file. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. + /// URL support is _experimental_. + /// If a file descriptor is provided, the underlying file will _not_ be closed automatically. + /// Either the encoding for the result, or an object that contains the encoding and an optional flag. + /// If a flag is not provided, it defaults to `'r'`. abstract __promisify__: path: U2 * options: U2 -> Promise - /// Asynchronously reads the entire contents of a file. + /// Asynchronously reads the entire contents of a file. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. + /// URL support is _experimental_. + /// If a file descriptor is provided, the underlying file will _not_ be closed automatically. + /// Either the encoding for the result, or an object that contains the encoding and an optional flag. + /// If a flag is not provided, it defaults to `'r'`. abstract __promisify__: path: U2 * ?options: U2 option -> Promise> module WriteFile = type [] IExports = - /// Asynchronously writes data to a file, replacing the file if it already exists. + /// Asynchronously writes data to a file, replacing the file if it already exists. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. + /// URL support is _experimental_. + /// If a file descriptor is provided, the underlying file will _not_ be closed automatically. + /// The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string. + /// Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag. + /// If `encoding` is not supplied, the default of `'utf8'` is used. + /// If `mode` is not supplied, the default of `0o666` is used. + /// If `mode` is a string, it is parsed as an octal integer. + /// If `flag` is not supplied, the default of `'w'` is used. abstract __promisify__: path: U2 * data: obj option * ?options: U2 option -> Promise module AppendFile = type [] IExports = - /// Asynchronously append data to a file, creating the file if it does not exist. + /// Asynchronously append data to a file, creating the file if it does not exist. + /// A path to a file. If a URL is provided, it must use the `file:` protocol. + /// URL support is _experimental_. + /// If a file descriptor is provided, the underlying file will _not_ be closed automatically. + /// The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string. + /// Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag. + /// If `encoding` is not supplied, the default of `'utf8'` is used. + /// If `mode` is not supplied, the default of `0o666` is used. + /// If `mode` is a string, it is parsed as an octal integer. + /// If `flag` is not supplied, the default of `'a'` is used. abstract __promisify__: file: U2 * data: obj option * ?options: U2 option -> Promise module Exists = type [] IExports = + /// A path to a file or directory. If a URL is provided, it must use the `file:` protocol. + /// URL support is _experimental_. abstract __promisify__: path: PathLike -> Promise module Constants = @@ -3134,23 +3540,28 @@ module Fs = module Access = type [] IExports = - /// Asynchronously tests a user's permissions for the file specified by path. + /// Asynchronously tests a user's permissions for the file specified by path. + /// A path to a file or directory. If a URL is provided, it must use the `file:` protocol. + /// URL support is _experimental_. abstract __promisify__: path: PathLike * ?mode: float -> Promise module Fdatasync = type [] IExports = - /// Asynchronous fdatasync(2) - synchronize a file's in-core state with storage device. + /// Asynchronous fdatasync(2) - synchronize a file's in-core state with storage device. + /// A file descriptor. abstract __promisify__: fd: float -> Promise module CopyFile = type [] IExports = - /// Asynchronously copies src to dest. By default, dest is overwritten if it already exists. + /// 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. + /// to remove the destination. + /// A path to the source file. + /// An optional 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. abstract __promisify__: src: PathLike * dst: PathLike * ?flags: float -> Promise module Path = @@ -3158,34 +3569,43 @@ module Path = let [] win32: Win32.IExports = jsNative type [] IExports = - /// Normalize a string path, reducing '..' and '.' parts. - /// When multiple slashes are found, they're replaced by a single one; when the path contains a trailing slash, it is preserved. On Windows backslashes are used. + /// Normalize a string path, reducing '..' and '.' parts. + /// When multiple slashes are found, they're replaced by a single one; when the path contains a trailing slash, it is preserved. On Windows backslashes are used. + /// string path to normalize. abstract normalize: p: string -> string - /// Join all arguments together and normalize the resulting path. - /// Arguments must be strings. In v0.8, non-string arguments were silently ignored. In v0.10 and up, an exception is thrown. + /// Join all arguments together and normalize the resulting path. + /// Arguments must be strings. In v0.8, non-string arguments were silently ignored. In v0.10 and up, an exception is thrown. + /// paths to join. abstract join: [] paths: ResizeArray -> string - /// The right-most parameter is considered {to}. Other parameters are considered an array of {from}. + /// The right-most parameter is considered {to}. Other parameters are considered an array of {from}. /// /// Starting from leftmost {from} paramter, resolves {to} to an absolute path. /// - /// If {to} isn't already absolute, {from} arguments are prepended in right to left order, until an absolute path is found. If after using all {from} paths still no absolute path is found, the current working directory is used as well. The resulting path is normalized, and trailing slashes are removed unless the path gets resolved to the root directory. + /// If {to} isn't already absolute, {from} arguments are prepended in right to left order, until an absolute path is found. If after using all {from} paths still no absolute path is found, the current working directory is used as well. The resulting path is normalized, and trailing slashes are removed unless the path gets resolved to the root directory. + /// string paths to join. Non-string arguments are ignored. abstract resolve: [] pathSegments: ResizeArray -> string - /// Determines whether {path} is an absolute path. An absolute path will always resolve to the same location, regardless of the working directory. + /// Determines whether {path} is an absolute path. An absolute path will always resolve to the same location, regardless of the working directory. + /// path to test. abstract isAbsolute: path: string -> bool /// Solve the relative path from {from} to {to}. /// At times we have two absolute paths, and we need to derive the relative path from one to the other. This is actually the reverse transform of path.resolve. abstract relative: from: string * ``to``: string -> string - /// Return the directory name of a path. Similar to the Unix dirname command. + /// Return the directory name of a path. Similar to the Unix dirname command. + /// the path to evaluate. abstract dirname: p: string -> string - /// Return the last portion of a path. Similar to the Unix basename command. - /// Often used to extract the file name from a fully qualified path. + /// Return the last portion of a path. Similar to the Unix basename command. + /// Often used to extract the file name from a fully qualified path. + /// the path to evaluate. + /// optionally, an extension to remove from the result. abstract basename: p: string * ?ext: string -> string - /// Return the extension of the path, from the last '.' to end of string in the last portion of the path. - /// If there is no '.' in the last portion of the path or the first character of it is '.', then it returns an empty string + /// Return the extension of the path, from the last '.' to end of string in the last portion of the path. + /// If there is no '.' in the last portion of the path or the first character of it is '.', then it returns an empty string + /// the path to evaluate. abstract extname: p: string -> string abstract sep: string abstract delimiter: string - /// Returns an object from a path string - the opposite of format(). + /// Returns an object from a path string - the opposite of format(). + /// path to evaluate. abstract parse: pathString: string -> ParsedPath /// Returns a path string from an object - the opposite of parse(). abstract format: pathObject: FormatInputPathObject -> string @@ -3322,11 +3742,12 @@ module Tls = abstract encrypted: bool with get, set /// Returns an object representing the cipher name and the SSL/TLS protocol version of the current connection. abstract getCipher: unit -> CipherNameAndProtocol - /// Returns an object representing the peer's certificate. + /// Returns an object representing the peer's certificate. /// The returned object has some properties corresponding to the field of the certificate. /// If detailed argument is true the full chain with issuer property will be returned, /// if false only the top certificate without issuer property. - /// If the peer does not provide a certificate, it returns null or an empty object. + /// If the peer does not provide a certificate, it returns null or an empty object. + /// - If true; the full chain with issuer property will be returned. abstract getPeerCertificate: detailed: obj -> DetailedPeerCertificate abstract getPeerCertificate: ?detailed: obj -> PeerCertificate abstract getPeerCertificate: ?detailed: bool -> U2 @@ -3335,17 +3756,22 @@ module Tls = /// NOTE: Works only with client TLS sockets. /// Useful only for debugging, for session reuse provide session option to tls.connect(). abstract getTLSTicket: unit -> obj option - /// Initiate TLS renegotiation process. + /// Initiate TLS renegotiation process. /// /// NOTE: Can be used to request peer's certificate after the secure connection has been established. - /// ANOTHER NOTE: When running as the server, socket will be destroyed with an error after handshakeTimeout timeout. + /// ANOTHER NOTE: When running as the server, socket will be destroyed with an error after handshakeTimeout timeout. + /// - The options may contain the following fields: rejectUnauthorized, + /// requestCert (See tls.createServer() for details). + /// - callback(err) will be executed with null as err, once the renegotiation + /// is successfully completed. abstract renegotiate: options: TlsOptions * callback: (Error option -> unit) -> obj option - /// Set maximum TLS fragment size (default and maximum value is: 16384, minimum is: 512). + /// Set maximum TLS fragment size (default and maximum value is: 16384, minimum is: 512). /// Smaller fragment size decreases buffering latency on the client: large fragments are buffered by /// the TLS layer until the entire fragment is received and its integrity is verified; /// large fragments can span multiple roundtrips, and their processing can be delayed due to packet /// loss or reordering. However, smaller fragments add extra TLS framing bytes and CPU overhead, - /// which may decrease overall server throughput. + /// which may decrease overall server throughput. + /// - TLS fragment size (default and maximum value is: 16384, minimum is: 512). abstract setMaxSendFragment: size: float -> bool /// events.EventEmitter /// 1. OCSPResponse @@ -4564,22 +4990,31 @@ module Async_hooks = /// Returns the ID of the resource responsible for calling the callback that is currently being executed. abstract triggerAsyncId: unit -> float abstract triggerId: unit -> float - /// Registers functions to be called for different lifetime events of each async operation. + /// Registers functions to be called for different lifetime events of each async operation. + /// the callbacks to register abstract createHook: options: HookCallbacks -> AsyncHook abstract AsyncResource: AsyncResourceStatic type [] HookCallbacks = - /// Called when a class is constructed that has the possibility to emit an asynchronous event. + /// Called when a class is constructed that has the possibility to emit an asynchronous event. + /// a unique ID for the async resource + /// the type of the async resource + /// the unique ID of the async resource in whose execution context this async resource was created + /// reference to the resource representing the async operation, needs to be released during destroy abstract init: asyncId: float * ``type``: string * triggerAsyncId: float * resource: Object -> unit - /// 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. + /// 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. + /// the unique identifier assigned to the resource about to execute the callback. abstract before: asyncId: float -> unit - /// Called immediately after the callback specified in before is completed. + /// Called immediately after the callback specified in before is completed. + /// the unique identifier assigned to the resource which has executed the callback. abstract after: asyncId: float -> unit - /// Called when a promise has resolve() called. This may not be in the same execution id - /// as the promise itself. + /// Called when a promise has resolve() called. This may not be in the same execution id + /// as the promise itself. + /// the unique id for the promise that was resolve()d. abstract promiseResolve: asyncId: float -> unit - /// Called after the resource corresponding to asyncId is destroyed + /// Called after the resource corresponding to asyncId is destroyed + /// a unique ID for the async resource abstract destroy: asyncId: float -> unit type [] AsyncHook = @@ -4603,9 +5038,11 @@ module Async_hooks = /// The class AsyncResource was designed to be extended by the embedder's async resources. /// Using this users can easily trigger the lifetime events of their own resources. type [] AsyncResourceStatic = - /// AsyncResource() is meant to be extended. Instantiating a + /// AsyncResource() is meant to be extended. Instantiating a /// new AsyncResource() also triggers init. If triggerAsyncId is omitted then - /// async_hook.executionAsyncId() is used. + /// async_hook.executionAsyncId() is used. + /// the name of this async resource type + /// the unique ID of the async resource in whose execution context this async resource was created [] abstract Create: ``type``: string * ?triggerAsyncId: float -> AsyncResource module Http2 = diff --git a/src/TypeScript.fs b/src/TypeScript.fs index 2eb0c817..24e655ad 100644 --- a/src/TypeScript.fs +++ b/src/TypeScript.fs @@ -75,13 +75,18 @@ module Ts = abstract validateLocaleAndSetLanguage: locale: string * sys: ValidateLocaleAndSetLanguageSys * ?errors: Push -> unit abstract getOriginalNode: node: Node -> Node abstract getOriginalNode: node: Node * nodeTest: (Node -> bool) -> 'T - /// Gets a value indicating whether a node originated in the parse tree. + /// Gets a value indicating whether a node originated in the parse tree. + /// The node to test. abstract isParseTreeNode: node: Node -> bool - /// Gets the original parse tree node for a node. + /// Gets the original parse tree node for a node. + /// The original node. abstract getParseTreeNode: node: Node -> Node - /// Gets the original parse tree node for a node. + /// Gets the original parse tree node for a node. + /// The original node. + /// A callback used to ensure the correct type of parse tree node is returned. abstract getParseTreeNode: node: Node * ?nodeTest: (Node -> bool) -> 'T - /// Remove extra underscore from escaped identifier text content. + /// Remove extra underscore from escaped identifier text content. + /// The escaped identifier text. abstract unescapeLeadingUnderscores: identifier: __String -> string abstract idText: identifier: Identifier -> string abstract symbolName: symbol: Symbol -> string @@ -298,18 +303,26 @@ module Ts = abstract isSetAccessor: node: Node -> bool abstract isGetAccessor: node: Node -> bool abstract createNode: kind: SyntaxKind * ?pos: float * ?``end``: float -> Node - /// Invokes a callback for each child of the given node. The 'cbNode' callback is invoked for all child nodes + /// Invokes a callback for each child of the given node. The 'cbNode' callback is invoked for all child nodes /// stored in properties. If a 'cbNodes' callback is specified, it is invoked for embedded arrays; otherwise, /// embedded arrays are flattened and the 'cbNode' callback is invoked for each element. If a callback returns - /// a truthy value, iteration stops and that value is returned. Otherwise, undefined is returned. + /// a truthy value, iteration stops and that value is returned. Otherwise, undefined is returned. + /// a given node to visit its children + /// a callback to be invoked for all child nodes + /// a callback to be invoked for embedded array abstract forEachChild: node: Node * cbNode: (Node -> 'T option) * ?cbNodes: (ResizeArray -> 'T option) -> 'T option abstract createSourceFile: fileName: string * sourceText: string * languageVersion: ScriptTarget * ?setParentNodes: bool * ?scriptKind: ScriptKind -> SourceFile abstract parseIsolatedEntityName: text: string * languageVersion: ScriptTarget -> EntityName - /// Parse json text into SyntaxTree and return node and parse errors if any + /// Parse json text into SyntaxTree and return node and parse errors if any + /// + /// abstract parseJsonText: fileName: string * sourceText: string -> JsonSourceFile abstract isExternalModule: file: SourceFile -> bool abstract updateSourceFile: sourceFile: SourceFile * newText: string * textChangeRange: TextChangeRange * ?aggressiveChecks: bool -> SourceFile abstract getEffectiveTypeRoots: options: CompilerOptions * host: GetEffectiveTypeRootsHost -> ResizeArray option + /// - file that contains type reference directive, can be undefined if containing file is unknown. + /// This is possible in case if resolution is performed for directives specified via 'types' parameter. In this case initial path for secondary lookups + /// is assumed to be the same as root directory of the project. abstract resolveTypeReferenceDirective: typeReferenceDirectiveName: string * containingFile: string option * options: CompilerOptions * host: ModuleResolutionHost -> ResolvedTypeReferenceDirectiveWithFailedLookupLocations /// Given a set of options, returns the set of type directive names /// that should be included for this program automatically. @@ -596,11 +609,14 @@ module Ts = abstract updateSourceFileNode: node: SourceFile * statements: ResizeArray -> SourceFile /// Creates a shallow, memberwise clone of a node for mutation. abstract getMutableClone: node: 'T -> 'T - /// Creates a synthetic statement to act as a placeholder for a not-emitted statement in - /// order to preserve comments. + /// Creates a synthetic statement to act as a placeholder for a not-emitted statement in + /// order to preserve comments. + /// The original statement. abstract createNotEmittedStatement: original: Node -> NotEmittedStatement - /// Creates a synthetic expression to act as a placeholder for a not-emitted expression in - /// order to preserve comments or sourcemap positions. + /// Creates a synthetic expression to act as a placeholder for a not-emitted expression in + /// order to preserve comments or sourcemap positions. + /// The inner expression to emit. + /// The original outer expression. abstract createPartiallyEmittedExpression: expression: Expression * ?original: Node -> PartiallyEmittedExpression abstract updatePartiallyEmittedExpression: node: PartiallyEmittedExpression * expression: Expression -> PartiallyEmittedExpression abstract createCommaList: elements: ResizeArray -> CommaListExpression @@ -626,7 +642,8 @@ module Ts = abstract createVoidZero: unit -> VoidExpression abstract createExportDefault: expression: Expression -> ExportAssignment abstract createExternalModuleExport: exportName: Identifier -> ExportDeclaration - /// Clears any EmitNode entries from parse-tree nodes. + /// Clears any EmitNode entries from parse-tree nodes. + /// A source file. abstract disposeEmitNodes: sourceFile: SourceFile -> unit abstract setTextRange: range: 'T * location: TextRange option -> 'T /// Sets flags that control emit behavior of a node. @@ -666,13 +683,31 @@ module Ts = /// Moves matching emit helpers from a source node to a target node. abstract moveEmitHelpers: source: Node * target: Node * predicate: (EmitHelper -> bool) -> unit abstract setOriginalNode: node: 'T * original: Node option -> 'T - /// Visits a Node using the supplied visitor, possibly returning a new Node in its place. + /// Visits a Node using the supplied visitor, possibly returning a new Node in its place. + /// The Node to visit. + /// The callback used to visit the Node. + /// A callback to execute to verify the Node is valid. + /// An optional callback to execute to lift a NodeArray into a valid Node. abstract visitNode: node: 'T * visitor: Visitor * ?test: (Node -> bool) * ?lift: (ResizeArray -> 'T) -> 'T - /// Visits a Node using the supplied visitor, possibly returning a new Node in its place. + /// Visits a Node using the supplied visitor, possibly returning a new Node in its place. + /// The Node to visit. + /// The callback used to visit the Node. + /// A callback to execute to verify the Node is valid. + /// An optional callback to execute to lift a NodeArray into a valid Node. abstract visitNode: node: 'T option * visitor: Visitor * ?test: (Node -> bool) * ?lift: (ResizeArray -> 'T) -> 'T option - /// Visits a NodeArray using the supplied visitor, possibly returning a new NodeArray in its place. + /// Visits a NodeArray using the supplied visitor, possibly returning a new NodeArray in its place. + /// The NodeArray to visit. + /// The callback used to visit a Node. + /// A node test to execute for each node. + /// An optional value indicating the starting offset at which to start visiting. + /// An optional value indicating the maximum number of nodes to visit. abstract visitNodes: nodes: ResizeArray<'T> * visitor: Visitor * ?test: (Node -> bool) * ?start: float * ?count: float -> ResizeArray<'T> - /// Visits a NodeArray using the supplied visitor, possibly returning a new NodeArray in its place. + /// Visits a NodeArray using the supplied visitor, possibly returning a new NodeArray in its place. + /// The NodeArray to visit. + /// The callback used to visit a Node. + /// A node test to execute for each node. + /// An optional value indicating the starting offset at which to start visiting. + /// An optional value indicating the maximum number of nodes to visit. abstract visitNodes: nodes: ResizeArray<'T> option * visitor: Visitor * ?test: (Node -> bool) * ?start: float * ?count: float -> ResizeArray<'T> option /// Starts a new lexical environment and visits a statement list, ending the lexical environment /// and merging hoisted declarations upon completion. @@ -689,9 +724,15 @@ module Ts = /// Resumes a suspended lexical environment and visits a concise body, ending the lexical /// environment and merging hoisted declarations upon completion. abstract visitFunctionBody: node: ConciseBody * visitor: Visitor * context: TransformationContext -> ConciseBody - /// Visits each child of a Node using the supplied visitor, possibly returning a new Node of the same kind in its place. + /// Visits each child of a Node using the supplied visitor, possibly returning a new Node of the same kind in its place. + /// The Node whose children will be visited. + /// The callback used to visit each child. + /// A lexical environment context for the visitor. abstract visitEachChild: node: 'T * visitor: Visitor * context: TransformationContext -> 'T - /// Visits each child of a Node using the supplied visitor, possibly returning a new Node of the same kind in its place. + /// Visits each child of a Node using the supplied visitor, possibly returning a new Node of the same kind in its place. + /// The Node whose children will be visited. + /// The callback used to visit each child. + /// A lexical environment context for the visitor. abstract visitEachChild: node: 'T option * visitor: Visitor * context: TransformationContext * ?nodesVisitor: obj * ?tokenVisitor: Visitor -> 'T option abstract createPrinter: ?printerOptions: PrinterOptions * ?handlers: PrintHandlers -> Printer abstract findConfigFile: searchPath: string * fileExists: (string -> bool) * ?configName: string -> string @@ -702,24 +743,39 @@ module Ts = abstract formatDiagnostic: diagnostic: Diagnostic * host: FormatDiagnosticsHost -> string abstract formatDiagnosticsWithColorAndContext: diagnostics: ResizeArray * host: FormatDiagnosticsHost -> string abstract flattenDiagnosticMessageText: messageText: U2 * newLine: string -> string - /// Create a new 'Program' instance. A Program is an immutable collection of 'SourceFile's and a 'CompilerOptions' + /// Create a new 'Program' instance. A Program is an immutable collection of 'SourceFile's and a 'CompilerOptions' /// that represent a compilation unit. /// /// Creating a program proceeds from a set of root files, expanding the set of inputs by following imports and - /// triple-slash-reference-path directives transitively. '@types' and triple-slash-reference-types are also pulled in. + /// triple-slash-reference-path directives transitively. '@types' and triple-slash-reference-types are also pulled in. + /// - A set of root files. + /// - The compiler options which should be used. + /// - The host interacts with the underlying file system. + /// - Reuses an old program structure. abstract createProgram: rootNames: ResizeArray * options: CompilerOptions * ?host: CompilerHost * ?oldProgram: Program -> Program abstract parseCommandLine: commandLine: ResizeArray * ?readFile: (string -> string option) -> ParsedCommandLine - /// Read tsconfig.json file + /// Read tsconfig.json file + /// The path to the config file abstract readConfigFile: fileName: string * readFile: (string -> string option) -> obj - /// Parse the text of the tsconfig.json file + /// Parse the text of the tsconfig.json file + /// The path to the config file + /// The text of the config file abstract parseConfigFileTextToJson: fileName: string * jsonText: string -> obj - /// Read tsconfig.json file + /// Read tsconfig.json file + /// The path to the config file abstract readJsonConfigFile: fileName: string * readFile: (string -> string option) -> JsonSourceFile /// Convert the json syntax tree into the json value abstract convertToObject: sourceFile: JsonSourceFile * errors: Push -> obj option - /// Parse the contents of a config file (tsconfig.json). + /// Parse the contents of a config file (tsconfig.json). + /// The contents of the config file to parse + /// Instance of ParseConfigHost used to enumerate files in folder. + /// A root directory to resolve relative path entries in the config + /// file to. e.g. outDir abstract parseJsonConfigFileContent: json: obj option * host: ParseConfigHost * basePath: string * ?existingOptions: CompilerOptions * ?configFileName: string * ?resolutionStack: ResizeArray * ?extraFileExtensions: ResizeArray -> ParsedCommandLine - /// Parse the contents of a config file (tsconfig.json). + /// Parse the contents of a config file (tsconfig.json). + /// Instance of ParseConfigHost used to enumerate files in folder. + /// A root directory to resolve relative path entries in the config + /// file to. e.g. outDir abstract parseJsonSourceFileConfigFileContent: sourceFile: JsonSourceFile * host: ParseConfigHost * basePath: string * ?existingOptions: CompilerOptions * ?configFileName: string * ?resolutionStack: ResizeArray * ?extraFileExtensions: ResizeArray -> ParsedCommandLine abstract convertCompilerOptionsFromJson: jsonOptions: obj option * basePath: string * ?configFileName: string -> obj abstract convertTypeAcquisitionFromJson: jsonOptions: obj option * basePath: string * ?configFileName: string -> obj @@ -742,7 +798,10 @@ module Ts = /// node package. /// The functionality is not supported if the ts module is consumed outside of a node module. abstract getDefaultLibFilePath: options: CompilerOptions -> string - /// Transform one or more nodes using the supplied transformers. + /// Transform one or more nodes using the supplied transformers. + /// A single `Node` or an array of `Node` objects. + /// An array of `TransformerFactory` callbacks used to process the transformation. + /// Optional compiler options. abstract transform: source: U2<'T, ResizeArray<'T>> * transformers: ResizeArray> * ?compilerOptions: CompilerOptions -> TransformationResult<'T> type [] ValidateLocaleAndSetLanguageSys = @@ -776,7 +835,7 @@ module Ts = /// ES6 Iterator type. type [] Iterator<'T> = - interface end + abstract next: unit -> U2 /// Array that is only intended to be pushed to, never read. type [] Push<'T> = @@ -3435,7 +3494,8 @@ module Ts = type [] ParseConfigHost = abstract useCaseSensitiveFileNames: bool with get, set abstract readDirectory: rootDir: string * extensions: ResizeArray * excludes: ResizeArray * includes: ResizeArray * depth: float -> ResizeArray - /// Gets a value indicating whether the specified path exists and is a file. + /// Gets a value indicating whether the specified path exists and is a file. + /// The path to test. abstract fileExists: path: string -> bool abstract readFile: path: string -> string option @@ -3562,7 +3622,8 @@ module Ts = abstract getAugmentedPropertiesOfType: ``type``: Type -> ResizeArray abstract getRootSymbols: symbol: Symbol -> ResizeArray abstract getContextualType: node: Expression -> Type option - /// returns unknownSignature in the case of an error. + /// returns unknownSignature in the case of an error. + /// Apparent number of arguments, passed in case of a possibly incomplete call. This should come from an ArgumentListInfo. See `signatureHelp.ts`. abstract getResolvedSignature: node: CallLikeExpression * ?candidatesOutArray: ResizeArray * ?argumentCount: float -> Signature abstract getSignatureFromDeclaration: declaration: SignatureDeclaration -> Signature option abstract isImplementationOfOverload: node: FunctionLike -> bool option @@ -4469,9 +4530,14 @@ module Ts = abstract transformed: ResizeArray<'T> with get, set /// Gets diagnostics for the transformation. abstract diagnostics: ResizeArray option with get, set - /// Gets a substitute for a node, if one is available; otherwise, returns the original node. + /// Gets a substitute for a node, if one is available; otherwise, returns the original node. + /// A hint as to the intended usage of the node. + /// The node to substitute. abstract substituteNode: hint: EmitHint * node: Node -> Node - /// Emits a node with possible notification. + /// Emits a node with possible notification. + /// A hint as to the intended usage of the node. + /// The node to emit. + /// A callback used to emit the node. abstract emitNodeWithNotification: hint: EmitHint * node: Node * emitCallback: (EmitHint -> Node -> unit) -> unit /// Clean up EmitNode entries on any parse-tree nodes. abstract dispose: unit -> unit @@ -4500,7 +4566,17 @@ module Ts = let asTArray (v: VisitResult<'T>) = match v with None -> None | Some o -> match o with U2.Case2 o -> Some o | _ -> None type [] Printer = - /// Print a node and its subtree as-is, without any emit transformations. + /// Print a node and its subtree as-is, without any emit transformations. + /// A value indicating the purpose of a node. This is primarily used to + /// distinguish between an `Identifier` used in an expression position, versus an + /// `Identifier` used as an `IdentifierName` as part of a declaration. For most nodes you + /// should just pass `Unspecified`. + /// The node to print. The node and its subtree are printed as-is, without any + /// emit transformations. + /// A source file that provides context for the node. The source text of + /// the file is used to emit the original source content for literals and identifiers, while + /// the identifiers of the source file are used when generating unique names to avoid + /// collisions. abstract printNode: hint: EmitHint * node: Node * sourceFile: SourceFile -> string /// Prints a source file as-is, without any emit transformations. abstract printFile: sourceFile: SourceFile -> string @@ -4511,13 +4587,18 @@ module Ts = /// A hook used by the Printer when generating unique names to avoid collisions with /// globally defined names that exist outside of the current source file. abstract hasGlobalName: name: string -> bool - /// A hook used by the Printer to provide notifications prior to emitting a node. A + /// A hook used by the Printer to provide notifications prior to emitting a node. A /// compatible implementation **must** invoke `emitCallback` with the provided `hint` and - /// `node` values. + /// `node` values. + /// A hint indicating the intended purpose of the node. + /// The node to emit. + /// A callback that, when invoked, will emit the node. abstract onEmitNode: hint: EmitHint * node: Node * emitCallback: (EmitHint -> Node -> unit) -> unit - /// A hook used by the Printer to perform just-in-time substitution of a node. This is + /// A hook used by the Printer to perform just-in-time substitution of a node. This is /// primarily used by node transformations that need to substitute one node for another, - /// such as replacing `myExportedVar` with `exports.myExportedVar`. + /// such as replacing `myExportedVar` with `exports.myExportedVar`. + /// A hint indicating the intended purpose of the node. + /// The node to emit. abstract substituteNode: hint: EmitHint * node: Node -> Node type [] PrinterOptions = @@ -5149,13 +5230,22 @@ module Ts = abstract classification: TokenClass with get, set type [] Classifier = - /// Gives lexical classifications of tokens on a line without any syntactic context. + /// Gives lexical classifications of tokens on a line without any syntactic context. /// For instance, a token consisting of the text 'string' can be either an identifier /// named 'string' or the keyword 'string', however, because this classifier is not aware, /// it relies on certain heuristics to give acceptable results. For classifications where /// speed trumps accuracy, this function is preferable; however, for true accuracy, the /// syntactic classifier is ideal. In fact, in certain editing scenarios, combining the - /// lexical, syntactic, and semantic classifiers may issue the best user experience. + /// lexical, syntactic, and semantic classifiers may issue the best user experience. + /// The text of a line to classify. + /// The state of the lexical classifier at the end of the previous line. + /// Whether the client is *not* using a syntactic classifier. + /// If there is no syntactic classifier (syntacticClassifierAbsent=true), + /// certain heuristics may be used in its place; however, if there is a + /// syntactic classifier (syntacticClassifierAbsent=false), certain + /// classifications which may be incorrectly categorized will be given + /// back as Identifiers in order to allow the syntactic classifier to + /// subsume the classification. abstract getClassificationsForLine: text: string * lexState: EndOfLineState * syntacticClassifierAbsent: bool -> ClassificationResult abstract getEncodedLexicalClassifications: text: string * endOfLineState: EndOfLineState * syntacticClassifierAbsent: bool -> Classifications @@ -5269,21 +5359,33 @@ module Ts = /// To create a default DocumentRegistry, use createDocumentRegistry to create one, and pass it /// to all subsequent createLanguageService calls. type [] DocumentRegistry = - /// Request a stored SourceFile with a given fileName and compilationSettings. + /// Request a stored SourceFile with a given fileName and compilationSettings. /// The first call to acquire will call createLanguageServiceSourceFile to generate - /// the SourceFile if was not found in the registry. + /// the SourceFile if was not found in the registry. + /// The name of the file requested + /// Some compilation settings like target affects the + /// shape of a the resulting SourceFile. This allows the DocumentRegistry to store + /// multiple copies of the same file for different compilation settings. abstract acquireDocument: fileName: string * compilationSettings: CompilerOptions * scriptSnapshot: IScriptSnapshot * version: string * ?scriptKind: ScriptKind -> SourceFile abstract acquireDocumentWithKey: fileName: string * path: Path * compilationSettings: CompilerOptions * key: DocumentRegistryBucketKey * scriptSnapshot: IScriptSnapshot * version: string * ?scriptKind: ScriptKind -> SourceFile - /// Request an updated version of an already existing SourceFile with a given fileName + /// Request an updated version of an already existing SourceFile with a given fileName /// and compilationSettings. The update will in-turn call updateLanguageServiceSourceFile - /// to get an updated SourceFile. + /// to get an updated SourceFile. + /// The name of the file requested + /// Some compilation settings like target affects the + /// shape of a the resulting SourceFile. This allows the DocumentRegistry to store + /// multiple copies of the same file for different compilation settings. + /// Text of the file. + /// Current version of the file. abstract updateDocument: fileName: string * compilationSettings: CompilerOptions * scriptSnapshot: IScriptSnapshot * version: string * ?scriptKind: ScriptKind -> SourceFile abstract updateDocumentWithKey: fileName: string * path: Path * compilationSettings: CompilerOptions * key: DocumentRegistryBucketKey * scriptSnapshot: IScriptSnapshot * version: string * ?scriptKind: ScriptKind -> SourceFile abstract getKeyForCompilationSettings: settings: CompilerOptions -> DocumentRegistryBucketKey - /// Informs the DocumentRegistry that a file is not needed any longer. + /// Informs the DocumentRegistry that a file is not needed any longer. /// /// Note: It is not allowed to call release on a SourceFile that was not acquired from - /// this registry originally. + /// this registry originally. + /// The name of the file to be released + /// The compilation settings used to acquire the file abstract releaseDocument: fileName: string * compilationSettings: CompilerOptions -> unit abstract releaseDocumentWithKey: path: Path * key: DocumentRegistryBucketKey -> unit abstract reportStats: unit -> string diff --git a/src/print.fs b/src/print.fs index ff52454a..e42b1daf 100644 --- a/src/print.fs +++ b/src/print.fs @@ -4,7 +4,7 @@ open ts2fable.Naming let printType (tp: FsType): string = match tp with | FsType.Mapped mp -> mp.Name - | FsType.TODO -> "TODO" + | FsType.TODO -> "obj" | FsType.Array at -> sprintf "ResizeArray<%s>" (printType at) | FsType.Union un -> diff --git a/src/ts2fable.fs b/src/ts2fable.fs index 6aad3aaf..a67f8e1f 100644 --- a/src/ts2fable.fs +++ b/src/ts2fable.fs @@ -35,7 +35,7 @@ let transform (file: FsFile): FsFile = |> fixNamespace |> addTicForGenericFunctions // must be after fixEscapeWords |> addTicForGenericTypes - |> removeTodoMembers + // |> removeTodoMembers |> removeTypeParamsFromStatic |> removeDuplicateFunctions |> extractTypeLiterals // after fixEscapeWords