@types/mz
- Version 2.7.8
- Published
- 78.8 kB
- 1 dependency
- MIT license
Install
npm i @types/mz
yarn add @types/mz
pnpm add @types/mz
Overview
TypeScript definitions for mz
Index
Namespaces
fs
- access()
- appendFile()
- chmod()
- chown()
- close()
- copyFile()
- exists()
- fchmod()
- fchown()
- fdatasync()
- fstat()
- fstatSync()
- fsync()
- ftruncate()
- futimes()
- lchmod()
- lchown()
- link()
- lstat()
- mkdir()
- mkdtemp()
- open()
- read()
- readdir()
- readFile()
- readlink()
- realpath()
- rename()
- rmdir()
- stat()
- symlink()
- truncate()
- unlink()
- unwatchFile()
- utimes()
- watch()
- watchFile()
- write()
- writeFile()
- writev()
Namespaces
namespace child_process
module 'child_process.d.ts' {}
function exec
exec: { ( command: string, callback: ( error: ExecException | null, stdout: string, stderr: string ) => void ): ChildProcess; ( command: string, options: any, callback: (error: any, stdout: Buffer, stderr: Buffer) => void ): ChildProcess; ( command: string, options: any, callback: (error: any, stdout: string, stderr: string) => void ): ChildProcess; ( command: string, options: any, callback: (error: any, stdout: any, stderr: any) => void ): ChildProcess; (command: string, options: any): Promise<[Buffer, Buffer]>; (command: string, options?: any): Promise<[string, string]>; (command: string, options?: any): Promise<[any, any]>;};
function execFile
execFile: { ( file: string, callback: (error: Error | null, stdout: string, stderr: string) => void ): ChildProcess; ( file: string, args: readonly string[], callback: (error: Error, stdout: string, stderr: string) => void ): ChildProcess; ( file: string, options: ExecFileOptionsWithBufferEncoding, callback: (error: Error, stdout: Buffer, stderr: Buffer) => void ): ChildProcess; ( file: string, args: readonly string[], options: ExecFileOptionsWithBufferEncoding, callback: (error: Error, stdout: Buffer, stderr: Buffer) => void ): ChildProcess; ( file: string, options: any, callback: (error: Error, stdout: string, stderr: string) => void ): ChildProcess; ( file: string, args: readonly string[], options: any, callback: (error: Error, stdout: string, stderr: string) => void ): ChildProcess; ( file: string, options: ExecFileOptionsWithOtherEncoding, callback: (error: Error, stdout: any, stderr: any) => void ): ChildProcess; ( file: string, args: readonly string[], options: ExecFileOptionsWithOtherEncoding, callback: (error: Error, stdout: any, stderr: any) => void ): ChildProcess; ( file: string, args: string[], options: ExecFileOptionsWithBufferEncoding ): Promise<[Buffer, Buffer]>; (file: string, options: ExecFileOptionsWithBufferEncoding): Promise< [Buffer, Buffer] >; (file: string, args?: string[], options?: any): Promise<[string, string]>; (file: string, options?: any): Promise<[string, string]>; ( file: string, args?: string[], options?: ExecFileOptionsWithOtherEncoding ): Promise<[any, any]>; (file: string, options?: ExecFileOptionsWithOtherEncoding): Promise<[any, any]>;};
namespace crypto
module 'crypto.d.ts' {}
function pbkdf2
pbkdf2: { ( password: BinaryLike, salt: BinaryLike, iterations: number, keylen: number, digest: string, callback: (err: Error | null, derivedKey: Buffer) => any ): void; ( password: BinaryLike, salt: BinaryLike, iterations: number, keylen: number, digest: string ): Promise<Buffer>;};
function pseudoRandomBytes
pseudoRandomBytes: { (size: number, callback: (err: Error | null, buf: Buffer) => void): void; (size: number): Promise<Buffer>;};
function randomBytes
randomBytes: { (size: number, callback: (err: Error | null, buf: Buffer) => void): void; (size: number): Promise<Buffer>;};
namespace dns
module 'dns.d.ts' {}
function lookup
lookup: { ( hostname: string, family: number, callback: ( err: NodeJS.ErrnoException | null, address: string, family: number ) => void ): void; ( hostname: string, options: LookupOneOptions, callback: (err: any, address: string, family: number) => void ): void; ( hostname: string, options: LookupAllOptions, callback: (err: any, addresses: LookupAddress[]) => void ): void; ( hostname: string, options: LookupOptions, callback: ( err: any, address: string | LookupAddress[], family: number ) => void ): void; ( hostname: string, callback: (err: any, address: string, family: number) => void ): void; (hostname: string, options: LookupAllOptions): Promise<LookupAddress[]>; (hostname: string, options?: any): Promise<[string, number]>; (hostname: string, options: LookupOptions): Promise< LookupAddress[] | [string, number] >;};
function lookupService
lookupService: { ( address: string, port: number, callback: ( err: NodeJS.ErrnoException | null, hostname: string, service: string ) => void ): void; (address: string, port: number): Promise<[string, string]>;};
function resolve
resolve: { ( hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void ): void; ( hostname: string, rrtype: 'A' | 'AAAA' | 'CNAME' | 'NS' | 'PTR', callback: (err: any, addresses: string[]) => void ): void; ( hostname: string, rrtype: 'ANY', callback: (err: any, addresses: AnyRecord[]) => void ): void; ( hostname: string, rrtype: 'MX', callback: (err: any, addresses: MxRecord[]) => void ): void; ( hostname: string, rrtype: 'NAPTR', callback: (err: any, addresses: NaptrRecord[]) => void ): void; ( hostname: string, rrtype: 'SOA', callback: (err: any, addresses: SoaRecord) => void ): void; ( hostname: string, rrtype: 'SRV', callback: (err: any, addresses: SrvRecord[]) => void ): void; ( hostname: string, rrtype: 'TXT', callback: (err: any, addresses: string[][]) => void ): void; ( hostname: string, rrtype: string, callback: (err: any, addresses: any) => void ): void; (hostname: string, rrtype?: 'A' | 'AAAA' | 'CNAME' | 'NS' | 'PTR'): Promise< string[] >; (hostname: string, rrtype: 'ANY'): Promise<AnyRecord[]>; (hostname: string, rrtype: 'MX'): Promise<MxRecord[]>; (hostname: string, rrtype: 'NAPTR'): Promise<NaptrRecord[]>; (hostname: string, rrtype: 'SOA'): Promise<SoaRecord>; (hostname: string, rrtype: 'SRV'): Promise<SrvRecord[]>; (hostname: string, rrtype: 'TXT'): Promise<string[][]>; (hostname: string, rrtype: string): Promise<any>;};
function resolve4
resolve4: { ( hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void ): void; ( hostname: string, options: ResolveWithTtlOptions, callback: (err: any, addresses: RecordWithTtl[]) => void ): void; ( hostname: string, options: ResolveOptions, callback: (err: any, addresses: string[] | RecordWithTtl[]) => void ): void; (hostname: string): Promise<string[]>; (hostname: string, options: ResolveWithTtlOptions): Promise<RecordWithTtl[]>; (hostname: string, options?: ResolveOptions): Promise< string[] | RecordWithTtl[] >;};
function resolve6
resolve6: { ( hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void ): void; ( hostname: string, options: ResolveWithTtlOptions, callback: (err: any, addresses: RecordWithTtl[]) => void ): void; ( hostname: string, options: ResolveOptions, callback: (err: any, addresses: string[] | RecordWithTtl[]) => void ): void; (hostname: string): Promise<string[]>; (hostname: string, options: ResolveWithTtlOptions): Promise<RecordWithTtl[]>; (hostname: string, options?: ResolveOptions): Promise< string[] | RecordWithTtl[] >;};
function resolveAny
resolveAny: { ( hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: AnyRecord[]) => void ): void; (hostname: string): Promise<AnyRecord[]>;};
function resolveCname
resolveCname: { ( hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void ): void; (hostname: string): Promise<string[]>;};
function resolveMx
resolveMx: { ( hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void ): void; (hostname: string): Promise<MxRecord[]>;};
function resolveNaptr
resolveNaptr: { ( hostname: string, callback: ( err: NodeJS.ErrnoException | null, addresses: NaptrRecord[] ) => void ): void; (hostname: string): Promise<NaptrRecord[]>;};
function resolveNs
resolveNs: { ( hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void ): void; (hostname: string): Promise<string[]>;};
function resolvePtr
resolvePtr: { ( hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void ): void; (hostname: string): Promise<string[]>;};
function resolveSoa
resolveSoa: { ( hostname: string, callback: (err: NodeJS.ErrnoException | null, address: SoaRecord) => void ): void; (hostname: string): Promise<SoaRecord>;};
function resolveSrv
resolveSrv: { ( hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void ): void; (hostname: string): Promise<SrvRecord[]>;};
function resolveTxt
resolveTxt: { ( hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void ): void; (hostname: string): Promise<string[][]>;};
function reverse
reverse: { ( ip: string, callback: (err: NodeJS.ErrnoException | null, domains: string[]) => void ): void; (ip: string): Promise<string[]>;};
namespace fs
module 'fs.d.ts' {}
Asynchronous
rename(2)
.Change the name or location of a file or directory.
Parameter oldPath
A path to a file. If a URL is provided, it must use the
file:
protocol. URL support is _experimental_.Parameter newPath
A path to a file. If a URL is provided, it must use the
file:
protocol. URL support is _experimental_.
function access
access: { (path: PathLike, mode: number | undefined, callback: NoParamCallback): void; (path: PathLike, callback: NoParamCallback): void; (path: PathLike, mode?: number): Promise<void>;};
Tests a user's permissions for the file specified by
path
.Parameter path
A path to a file or directory. If a URL is provided, it must use the
file:
protocol. URL support is _experimental_.Parameter mode
An optional integer that specifies the accessibility checks to be performed.
Tests a user's permissions for the file specified by
path
.Parameter path
A path to a file or directory. If a URL is provided, it must use the
file:
protocol. URL support is _experimental_.
function appendFile
appendFile: { ( file: PathLike | number, data: any, options: WriteFileOptions, callback: NoParamCallback ): void; (file: any, data: any, callback: NoParamCallback): void; (file: any, data: any, options?: WriteFileOptions): Promise<void>;};
Asynchronously append data to a file, creating the file if it does not yet exist.
Parameter 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.Parameter data
The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string.
Parameter options
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. Ifmode
is not supplied, the default of0o666
is used. Ifmode
is a string, it is parsed as an octal integer. Ifflag
is not supplied, the default of'a'
is used.Asynchronously append data to a file, creating the file if it does not yet exist.
Parameter 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.Parameter data
The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string.
function chmod
chmod: { (path: PathLike, mode: string | number, callback: NoParamCallback): void; (path: PathLike, mode: string | number): Promise<void>;};
Asynchronous
chmod(2)
.Change permissions of a file.
Parameter path
A path to a file. If a URL is provided, it must use the
file:
protocol.Parameter mode
A file mode. If a string is passed, it is parsed as an octal integer.
function chown
chown: { (path: PathLike, uid: number, gid: number, callback: NoParamCallback): void; (path: PathLike, uid: number, gid: number): Promise<void>;};
Asynchronous
chown(2)
.Change ownership of a file.
Parameter path
A path to a file. If a URL is provided, it must use the
file:
protocol.
function close
close: { (fd: number, callback: NoParamCallback): void; (fd: number): Promise<void>;};
Asynchronous
close(2)
.close a file descriptor.
Parameter fd
A file descriptor.
function copyFile
copyFile: { (src: PathLike, dest: PathLike, callback: NoParamCallback): void; (src: PathLike, dest: PathLike, flags: number, callback: NoParamCallback): void; (src: PathLike, dest: PathLike, flags?: number): Promise<void>;};
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.
Parameter src
A path to the source file.
Parameter dest
A path to the destination file.
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.
Parameter src
A path to the source file.
Parameter dest
A path to the destination file.
Parameter flags
An integer that specifies the behavior of the copy operation. The only supported flag is fs.constants.COPYFILE_EXCL, which causes the copy operation to fail if dest already exists.
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.
Parameter src
A path to the source file.
Parameter dest
A path to the destination file.
Parameter flags
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.
function exists
exists: { ( path: PathLike, callback: (err: NodeJS.ErrnoException | null, exists: boolean) => void ): void; (path: PathLike): Promise<boolean>;};
Test whether or not the given path exists by checking with the file system.
Parameter path
A path to a file or directory. If a URL is provided, it must use the
file:
protocol. URL support is _experimental_.Deprecated
Test whether or not the given path exists by checking with the file system.
Parameter path
A path to a file or directory. If a URL is provided, it must use the
file:
protocol. URL support is _experimental_.
function fchmod
fchmod: { (fd: number, mode: string | number, callback: NoParamCallback): void; (fd: number, mode: string | number): Promise<void>;};
Asynchronous
fchmod(2)
.Change permissions of a file.
Parameter fd
A file descriptor.
Parameter mode
A file mode. If a string is passed, it is parsed as an octal integer.
function fchown
fchown: { (fd: number, uid: number, gid: number, callback: NoParamCallback): void; (fd: number, uid: number, gid: number, callback: NoParamCallback): void; (fd: number, uid: number, gid: number): Promise<void>;};
Asynchronous
fchown(2)
.Change ownership of a file.
Parameter fd
A file descriptor.
function fdatasync
fdatasync: { (fd: number, callback: NoParamCallback): void; (fd: number): Promise<void>;};
Asynchronous
fdatasync(2)
.Synchronize a file's in-core state with storage device.
Parameter fd
A file descriptor.
function fstat
fstat: { ( fd: number, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void ): void; (fd: number): Promise<Stats>;};
Asynchronous
fstat(2)
.Get file status.
Parameter fd
A file descriptor.
function fstatSync
fstatSync: (fd: number) => Stats;
Synchronous fstat(2) - Get file status.
Parameter fd
A file descriptor.
function fsync
fsync: { (fd: number, callback: NoParamCallback): void; (fd: number): Promise<void>;};
Asynchronous
fsync(2)
.synchronize a file's in-core state with the underlying storage device.
Parameter fd
A file descriptor.
function ftruncate
ftruncate: { (fd: number, len: number | null | undefined, callback: NoParamCallback): void; (fd: number, callback: NoParamCallback): void; (fd: number, len?: number): Promise<void>;};
Asynchronous
ftruncate(2)
.Truncate a file to a specified length.
Parameter fd
A file descriptor.
Parameter len
If not specified, defaults to
0
.Asynchronous
ftruncate(2)
.Truncate a file to a specified length.
Parameter fd
A file descriptor.
function futimes
futimes: { ( fd: number, atime: string | number | Date, mtime: string | number | Date, callback: NoParamCallback ): void; ( fd: number, atime: string | number | Date, mtime: string | number | Date ): Promise<void>;};
Change the file timestamps of a file referenced by the supplied file descriptor.
Parameter fd
A file descriptor.
Parameter atime
The last access time. If a string is provided, it will be coerced to number.
Parameter mtime
The last modified time. If a string is provided, it will be coerced to number.
function lchmod
lchmod: { (path: PathLike, mode: string | number, callback: NoParamCallback): void; (path: PathLike, mode: string | number): Promise<void>;};
Asynchronous
lchmod(2)
.Change permissions of a file. Does not dereference symbolic links.
Parameter path
A path to a file. If a URL is provided, it must use the
file:
protocol.Parameter mode
A file mode. If a string is passed, it is parsed as an octal integer.
function lchown
lchown: { (path: PathLike, uid: number, gid: number, callback: NoParamCallback): void; (path: PathLike, uid: number, gid: number): Promise<void>;};
Asynchronous
lchown(2)
.Change ownership of a file. Does not dereference symbolic links.
Parameter path
A path to a file. If a URL is provided, it must use the
file:
protocol.
function link
link: { (existingPath: PathLike, newPath: PathLike, callback: NoParamCallback): void; (existingPath: PathLike, newPath: PathLike): Promise<void>;};
Asynchronous
link(2)
.Create a new link (also known as a hard link) to an existing file.
Parameter existingPath
A path to a file. If a URL is provided, it must use the
file:
protocol.Parameter newPath
A path to a file. If a URL is provided, it must use the
file:
protocol.
function lstat
lstat: { ( path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void ): void; (path: PathLike): Promise<Stats>;};
Asynchronous
lstat(2)
.Get file status. Does not dereference symbolic links.
Parameter path
A path to a file. If a URL is provided, it must use the
file:
protocol.
function mkdir
mkdir: { ( path: PathLike, options: number | string | MakeDirectoryOptions | null | undefined, callback: NoParamCallback ): void; (path: PathLike, callback: NoParamCallback): void; (path: PathLike, options?: any): Promise<void>;};
Asynchronous
mkdir(2)
.Creates the directory specified in
path
.Parameter path
A path to a file. If a URL is provided, it must use the
file:
protocol.Parameter options
Either the file mode, or an object optionally specifying the file mode and whether parent folders should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to
0o777
.Asynchronous
mkdir(2)
.Creates the directory with a mode of
0o777
.Parameter path
A path to a file. If a URL is provided, it must use the
file:
protocol.
function mkdtemp
mkdtemp: { ( prefix: string, options: | { encoding?: BufferEncoding | null | undefined } | BufferEncoding | null | undefined, callback: (err: NodeJS.ErrnoException | null, folder: string) => void ): void; ( prefix: string, options: 'buffer' | { encoding: 'buffer' }, callback: (err: any, folder: Buffer) => void ): void; ( prefix: string, options: string | { encoding?: string }, callback: (err: any, folder: any) => void ): void; (prefix: string, callback: (err: any, folder: string) => void): void; (prefix: string, options?: any): Promise<string>; (prefix: string, options: 'buffer' | { encoding: 'buffer' }): Promise<Buffer>; (prefix: string, options?: string | { encoding?: string }): Promise<any>;};
Creates a unique temporary directory.
Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
Parameter prefix
temp dir prefix
Parameter options
The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided,
'utf8'
is used.* Creates a unique temporary directory.
Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
Parameter prefix
temp dir prefix
Parameter options
The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided,
'utf8'
is used.
function open
open: { ( path: PathLike, flags: string | number, mode: string | number | null | undefined, callback: (err: NodeJS.ErrnoException | null, fd: number) => void ): void; ( path: PathLike, flags: string | number, callback: (err: any, fd: number) => void ): void; ( path: PathLike, flags: string | number, mode?: string | number ): Promise<number>;};
Asynchronous
open(2)
.open and possibly create a file.
Parameter path
A path to a file. If a URL is provided, it must use the
file:
protocol.Parameter mode
A file mode. If a string is passed, it is parsed as an octal integer. If not supplied, defaults to
0o666
.Asynchronous
open(2)
.open and possibly create a file. If the file is created, its mode will be
0o666
.Parameter path
A path to a file. If a URL is provided, it must use the
file:
protocol.
function read
read: { <TBuffer extends NodeJS.ArrayBufferView>( fd: number, buffer: TBuffer, offset: number, length: number, position: number | null, callback: ( err: NodeJS.ErrnoException | null, bytesRead: number, buffer: TBuffer ) => void ): void; <TBuffer extends NodeJS.ArrayBufferView>( fd: number, buffer: TBuffer, offset: number, length: number, position: number ): Promise<[number, TBuffer]>;};
Read data from the file specified by
fd
.Parameter fd
A file descriptor.
Parameter buffer
The buffer that the data will be written to.
Parameter offset
The offset in the buffer at which to start writing.
Parameter length
The number of bytes to read.
Parameter position
The offset from the beginning of the file from which data should be read. If
null
, data will be read from the current position.
function readdir
readdir: { ( path: PathLike, options: | { encoding: BufferEncoding | null; withFileTypes?: false | undefined } | BufferEncoding | null | undefined, callback: (err: NodeJS.ErrnoException | null, files: string[]) => void ): void; ( path: PathLike, options: 'buffer' | { encoding: 'buffer'; withFileTypes?: false }, callback: (err: any, files: Buffer[]) => void ): void; ( path: PathLike, options: string | { encoding?: string; withFileTypes?: false }, callback: (err: any, files: string[] | Buffer[]) => void ): void; (path: PathLike, callback: (err: any, files: string[]) => void): void; ( path: PathLike, options: { encoding?: string; withFileTypes: true }, callback: (err: any, files: Dirent[]) => void ): void; (path: PathLike, options?: any): Promise<string[]>; ( path: PathLike, options: 'buffer' | { encoding: 'buffer'; withFileTypes?: false } ): Promise<Buffer[]>; ( path: PathLike, options?: string | { encoding?: string; withFileTypes?: false } ): Promise<string[] | Buffer[]>; (path: PathLike, options: { encoding?: string; withFileTypes: true }): Promise< Dirent[] >;};
Asynchronous
readdir(3)
.Reads the contents of a directory.
Parameter path
A path to a file. If a URL is provided, it must use the
file:
protocol.Parameter options
The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided,
'utf8'
is used.Asynchronous
readdir(3)
.Reads the contents of a directory.
Parameter path
A path to a file. If a URL is provided, it must use the
file:
protocol.Asynchronous
readdir(3)
.Reads the contents of a directory.
Parameter path
A path to a file. If a URL is provided, it must use the
file:
protocol.Parameter options
If called with
withFileTypes: true
the result data will be an array of Dirent.Asynchronous
readdir(3)
.Reads the contents of a directory.
Parameter path
A path to a file. If a URL is provided, it must use the
file:
protocol.Parameter options
If called with
withFileTypes: true
the result data will be an array of Dirent
function readFile
readFile: { ( path: PathLike | number, options: | { encoding?: null | undefined; flag?: string | undefined } | null | undefined, callback: (err: NodeJS.ErrnoException | null, data: Buffer) => void ): void; ( path: any, options: string | { encoding: string; flag?: string }, callback: (err: any, data: string) => void ): void; ( path: any, options: string | { encoding?: string; flag?: string }, callback: (err: any, data: any) => void ): void; (path: any, callback: (err: any, data: Buffer) => void): void; (path: any, options?: { encoding?: null; flag?: string }): Promise<Buffer>; ( path: any, options: string | { encoding: string; flag?: string } ): Promise<string>; ( path: any, options?: string | { encoding?: string; flag?: string } ): Promise<any>;};
Asynchronously reads the entire contents of a file.
Parameter path
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.Parameter options
An object that may contain an optional flag. If a flag is not provided, it defaults to
'r'
.Asynchronously reads the entire contents of a file.
Parameter path
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.Parameter options
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'
.Asynchronously reads the entire contents of a file.
Parameter path
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.
function readlink
readlink: { ( path: PathLike, options: | { encoding?: BufferEncoding | null | undefined } | BufferEncoding | null | undefined, callback: (err: NodeJS.ErrnoException | null, linkString: string) => void ): void; ( path: PathLike, options: { encoding: 'buffer' } | 'buffer', callback: (err: any, linkString: Buffer) => void ): void; ( path: PathLike, options: string | { encoding?: string }, callback: (err: any, linkString: any) => void ): void; (path: PathLike, callback: (err: any, linkString: string) => void): void; (path: PathLike, options?: any): Promise<string>; (path: PathLike, options: 'buffer' | { encoding: 'buffer' }): Promise<Buffer>; (path: PathLike, options?: string | { encoding?: string }): Promise<any>;};
Asynchronous
readlink(2)
.read value of a symbolic link.
Parameter path
A path to a file. If a URL is provided, it must use the
file:
protocol.Parameter options
The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided,
'utf8'
is used.Asynchronous
readlink(2)
.read value of a symbolic link.
Parameter path
A path to a file. If a URL is provided, it must use the
file:
protocol.
function realpath
realpath: typeof realpath;
Asynchronous
realpath(3)
.return the canonicalized absolute pathname.
Parameter path
A path to a file. If a URL is provided, it must use the
file:
protocol.Parameter options
The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided,
'utf8'
is used.Asynchronous
realpath(3)
.return the canonicalized absolute pathname.
Parameter path
A path to a file. If a URL is provided, it must use the
file:
protocol.
function rename
rename: { (oldPath: PathLike, newPath: PathLike, callback: NoParamCallback): void; (oldPath: PathLike, newPath: PathLike): Promise<void>;};
Asynchronous
rename(2)
.Change the name or location of a file or directory.
Parameter oldPath
A path to a file. If a URL is provided, it must use the
file:
protocol. URL support is _experimental_.Parameter newPath
A path to a file. If a URL is provided, it must use the
file:
protocol. URL support is _experimental_.
function rmdir
rmdir: { (path: PathLike, callback: NoParamCallback): void; (path: PathLike, options: RmDirOptions, callback: NoParamCallback): void; (path: PathLike, options?: RmDirOptions): Promise<void>;};
Asynchronous
rmdir(2)
Removes the directory specified in
path
.Parameter path
A path to a file. If a URL is provided, it must use the
file:
protocol.Asynchronous
rmdir(2)
.Removes the directory specified in
path
.Parameter path
A path to a file. If a URL is provided, it must use the
file:
protocol.
function stat
stat: { ( path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void ): void; (path: PathLike): Promise<Stats>;};
Asynchronous
stat(2)
.Get file status.
Parameter path
A path to a file. If a URL is provided, it must use the
file:
protocol.
function symlink
symlink: { ( target: PathLike, path: PathLike, type: symlinkNS.Type | null | undefined, callback: NoParamCallback ): void; (target: PathLike, path: PathLike, callback: NoParamCallback): void; (target: PathLike, path: PathLike, type?: string): Promise<void>;};
Asynchronous
symlink(2)
.Create a new symbolic link to an existing file.
Parameter target
A path to an existing file. If a URL is provided, it must use the
file:
protocol.Parameter path
A path to the new symlink. If a URL is provided, it must use the
file:
protocol.Parameter type
May be set to
'dir'
,'file'
, or'junction'
(default is'file'
) and is only available on Windows (ignored on other platforms). When using'junction'
, thetarget
argument will automatically be normalized to an absolute path.Asynchronous
symlink(2)
.Create a new symbolic link to an existing file.
Parameter target
A path to an existing file. If a URL is provided, it must use the
file:
protocol.Parameter path
A path to the new symlink. If a URL is provided, it must use the
file:
protocol.
function truncate
truncate: { ( path: PathLike, len: number | null | undefined, callback: NoParamCallback ): void; (path: PathLike, callback: NoParamCallback): void; (path: PathLike, len?: number): Promise<void>;};
Asynchronous
truncate(2)
.Truncate a file to a specified length.
Parameter path
A path to a file. If a URL is provided, it must use the
file:
protocol.Parameter len
If not specified, defaults to
0
.Asynchronous
truncate(2)
.Truncate a file to a specified length.
Parameter path
A path to a file. If a URL is provided, it must use the
file:
protocol. URL support is _experimental_.
function unlink
unlink: { (path: PathLike, callback: NoParamCallback): void; (path: PathLike): Promise<void>;};
Asynchronous
unlink(2)
.delete a name and possibly the file it refers to.
Parameter path
A path to a file. If a URL is provided, it must use the
file:
protocol.
function unwatchFile
unwatchFile: ( filename: PathLike, listener?: (curr: Stats, prev: Stats) => void) => void;
Stop watching for changes on
filename
.Parameter filename
A path to a file or directory. If a URL is provided, it must use the
file:
protocol. URL support is _experimental_.
function utimes
utimes: { ( path: PathLike, atime: string | number | Date, mtime: string | number | Date, callback: NoParamCallback ): void; ( path: PathLike, atime: string | number | Date, mtime: string | number | Date ): Promise<void>;};
Change the file timestamps of the file referenced by the supplied path.
Parameter path
A path to a file. If a URL is provided, it must use the
file:
protocol.Parameter atime
The last access time. If a string is provided, it will be coerced to number.
Parameter mtime
The last modified time. If a string is provided, it will be coerced to number.
function watch
watch: { ( filename: PathLike, options: | { encoding?: BufferEncoding | null | undefined; persistent?: boolean | undefined; recursive?: boolean | undefined; } | BufferEncoding | undefined | null, listener?: (event: string, filename: string) => void ): FSWatcher; ( filename: PathLike, options: | 'buffer' | { encoding: 'buffer'; persistent?: boolean; recursive?: boolean }, listener?: (event: string, filename: Buffer) => void ): FSWatcher; ( filename: PathLike, options: | string | { encoding?: string; persistent?: boolean; recursive?: boolean }, listener?: (event: string, filename: any) => void ): FSWatcher; ( filename: PathLike, listener?: (event: string, filename: string) => any ): FSWatcher;};
Watch for changes on
filename
, wherefilename
is either a file or a directory, returning anFSWatcher
.Parameter filename
A path to a file or directory. If a URL is provided, it must use the
file:
protocol. URL support is _experimental_.Parameter options
Either the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options. If
encoding
is not supplied, the default of'utf8'
is used. Ifpersistent
is not supplied, the default oftrue
is used. Ifrecursive
is not supplied, the default offalse
is used.Watch for changes on
filename
, wherefilename
is either a file or a directory, returning anFSWatcher
.Parameter filename
A path to a file or directory. If a URL is provided, it must use the
file:
protocol. URL support is _experimental_.
function watchFile
watchFile: { ( filename: PathLike, options: | { persistent?: boolean | undefined; interval?: number | undefined } | undefined, listener: (curr: Stats, prev: Stats) => void ): void; (filename: PathLike, listener: (curr: Stats, prev: Stats) => void): void;};
Watch for changes on
filename
. The callbacklistener
will be called each time the file is accessed.Watch for changes on
filename
. The callbacklistener
will be called each time the file is accessed.Parameter filename
A path to a file or directory. If a URL is provided, it must use the
file:
protocol. URL support is _experimental_.
function write
write: { <TBuffer extends NodeJS.ArrayBufferView>( fd: number, buffer: TBuffer, offset: number | null | undefined, length: number | null | undefined, position: number | null | undefined, callback: ( err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer ) => void ): void; <TBuffer extends NodeJS.ArrayBufferView>( fd: number, buffer: TBuffer, offset: number, length: number, callback: (err: any, written: number, buffer: TBuffer) => void ): void; <TBuffer extends NodeJS.ArrayBufferView>( fd: number, buffer: TBuffer, offset: number, callback: (err: any, written: number, buffer: TBuffer) => void ): void; <TBuffer extends NodeJS.ArrayBufferView>( fd: number, buffer: TBuffer, callback: (err: any, written: number, buffer: TBuffer) => void ): void; <TBuffer extends NodeJS.ArrayBufferView>( fd: number, buffer?: TBuffer, offset?: number, length?: number, position?: number ): Promise<[number, TBuffer]>; ( fd: number, data: any, position: number, encoding: string, callback: (err: any, written: number, str: string) => void ): void; ( fd: number, data: any, position: number, callback: (err: any, written: number, str: string) => void ): void; ( fd: number, data: any, callback: (err: any, written: number, str: string) => void ): void; (fd: number, string: any, position?: number, encoding?: string): Promise< [number, string] >;};
Write
buffer
to the file specified byfd
.Parameter fd
A file descriptor.
Parameter offset
The part of the buffer to be written. If not supplied, defaults to
0
.Parameter length
The number of bytes to write. If not supplied, defaults to
buffer.length - offset
.Parameter position
The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
Write
buffer
to the file specified byfd
.Parameter fd
A file descriptor.
Parameter offset
The part of the buffer to be written. If not supplied, defaults to
0
.Parameter length
The number of bytes to write. If not supplied, defaults to
buffer.length - offset
.Write
buffer
to the file specified byfd
.Parameter fd
A file descriptor.
Parameter offset
The part of the buffer to be written. If not supplied, defaults to
0
.Write
buffer
to the file specified byfd
.Parameter fd
A file descriptor.
Write
data
to the file specified byfd
.Parameter fd
A file descriptor.
Parameter string
A string to write. If something other than a string is supplied it will be coerced to a string.
Parameter position
The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
Parameter encoding
The expected string encoding.
Write
data
to the file specified byfd
.Parameter fd
A file descriptor.
Parameter string
A string to write. If something other than a string is supplied it will be coerced to a string.
Parameter position
The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
Write
data
to the file specified byfd
.Parameter fd
A file descriptor.
Parameter string
A string to write. If something other than a string is supplied it will be coerced to a string.
function writeFile
writeFile: { ( path: PathLike | number, data: any, options: WriteFileOptions, callback: NoParamCallback ): void; (path: any, data: any, callback: NoParamCallback): void; (path: any, data: any, options?: WriteFileOptions): Promise<void>;};
Asynchronously writes data to a file, replacing the file if it already exists.
Parameter path
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.Parameter data
The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string.
Parameter options
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. Ifmode
is not supplied, the default of0o666
is used. Ifmode
is a string, it is parsed as an octal integer. Ifflag
is not supplied, the default of'w'
is used.Asynchronously writes data to a file, replacing the file if it already exists.
Parameter path
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.Parameter data
The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string.
function writev
writev: { ( fd: number, buffers: NodeJS.ArrayBufferView[], cb: ( err: NodeJS.ErrnoException | null, bytesWritten: number, buffers: NodeJS.ArrayBufferView[] ) => void ): void; ( fd: number, buffers: NodeJS.ArrayBufferView[], position: number, cb: ( err: any, bytesWritten: number, buffers: NodeJS.ArrayBufferView[] ) => void ): void; (fd: number, buffers: NodeJS.ArrayBufferView[], position?: number): Promise< [number, NodeJS.ArrayBufferView[]] >;};
Write an array of ArrayBufferViews to the file specified by fd using writev().
Position is the offset from the beginning of the file where this data should be written. It is unsafe to use fs.writev() multiple times on the same file without waiting for the callback. For this scenario, use fs.createWriteStream(). On Linux, positional writes don't work when the file is opened in append mode. The kernel ignores the position argument and always appends the data to the end of the file.
namespace fs.realpath
namespace fs.realpath {}
function native
native: { ( path: PathLike, options: | { encoding?: BufferEncoding | null | undefined } | BufferEncoding | null | undefined, callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void ): void; ( path: PathLike, options: 'buffer' | { encoding: 'buffer' }, callback: (err: any, resolvedPath: Buffer) => void ): void; ( path: PathLike, options: string | { encoding?: string }, callback: (err: any, resolvedPath: any) => void ): void; (path: PathLike, callback: (err: any, resolvedPath: string) => void): void; (path: PathLike, options?: any): Promise<string>; (path: PathLike, options: 'buffer' | { encoding: 'buffer' }): Promise<Buffer>; (path: PathLike, options: string | { encoding?: string }): Promise<any>;};
namespace readline
module 'readline.d.ts' {}
function createInterface
createInterface: { ( input: NodeJS.ReadableStream, output?: NodeJS.WritableStream, completer?: Completer, terminal?: boolean ): Interface; (options: ReadLineOptions): Interface;};
class Interface
class Interface extends readline.Interface {}
method question
question: { (query: string, callback: (answer: string) => void): void; (query: string): Promise<string>;};
interface ReadLineOptions
interface ReadLineOptions extends readline.ReadLineOptions {}
property completer
completer?: Completer | undefined;
type AsyncCompleter
type AsyncCompleter = | (( line: string, callback: (err?: null | Error, result?: readline.CompleterResult) => void ) => void) | ((line: string) => Promise<readline.CompleterResult>);
type Completer
type Completer = AsyncCompleter | readline.Completer;
type ReadLine
type ReadLine = Interface;
namespace zlib
module 'zlib.d.ts' {}
Compress the buffer using the **Brotli Compression** algorithm.
Parameter buf
The buffer.
Parameter options
The compression options.
function brotliCompress
brotliCompress: { (buf: InputType, callback: CompressCallback): void; (buf: InputType, options: BrotliOptions, callback: CompressCallback): void; (buf: InputType, options?: BrotliOptions): Promise<Buffer>;};
Compress the buffer using the **Brotli Compression** algorithm.
Parameter buf
The buffer.
Parameter options
The compression options.
function brotliDecompress
brotliDecompress: { (buf: InputType, callback: CompressCallback): void; (buf: InputType, options: BrotliOptions, callback: CompressCallback): void; (buf: InputType, options?: BrotliOptions): Promise<Buffer>;};
Decompress the buffer using the **Brotli Compression** algorithm.
Parameter buf
The buffer.
Parameter options
The compression options.
function deflate
deflate: { (buf: InputType, callback: CompressCallback): void; (buf: InputType, options: ZlibOptions, callback: CompressCallback): void; (buf: InputType, options?: ZlibOptions): Promise<Buffer>;};
Compress the buffer using the **DEFLATE** algorithm.
Parameter buf
The buffer.
Parameter options
The compression options.
function deflateRaw
deflateRaw: { (buf: InputType, callback: CompressCallback): void; (buf: InputType, options: ZlibOptions, callback: CompressCallback): void; (buf: InputType, options?: ZlibOptions): Promise<Buffer>;};
Compress the buffer using the **DEFLATE** algorithm.
Parameter buf
The buffer.
Parameter options
The compression options.
function gunzip
gunzip: { (buf: InputType, callback: CompressCallback): void; (buf: InputType, options: ZlibOptions, callback: CompressCallback): void; (buf: InputType, options?: ZlibOptions): Promise<Buffer>;};
Decompress the buffer using the **GZIP** algorithm.
Parameter buf
The buffer.
Parameter options
The compression options.
function gzip
gzip: { (buf: InputType, callback: CompressCallback): void; (buf: InputType, options: ZlibOptions, callback: CompressCallback): void; (buf: InputType, options?: ZlibOptions): Promise<Buffer>;};
Compress the buffer using the **GZIP** algorithm.
Parameter buf
The buffer.
Parameter options
The compression options.
function inflate
inflate: { (buf: InputType, callback: CompressCallback): void; (buf: InputType, options: ZlibOptions, callback: CompressCallback): void; (buf: InputType, options?: ZlibOptions): Promise<Buffer>;};
Decompress the buffer using the **DEFLATE** algorithm.
Parameter buf
The buffer.
Parameter options
The compression options.
function inflateRaw
inflateRaw: { (buf: InputType, callback: CompressCallback): void; (buf: InputType, options: ZlibOptions, callback: CompressCallback): void; (buf: InputType, options?: ZlibOptions): Promise<Buffer>;};
Decompress the buffer using the **DEFLATE** algorithm.
Parameter buf
The buffer.
Parameter options
The compression options.
function unzip
unzip: { (buf: InputType, callback: CompressCallback): void; (buf: InputType, options: ZlibOptions, callback: CompressCallback): void; (buf: InputType, options?: ZlibOptions): Promise<Buffer>;};
Decompress the buffer using the **ZIP** algorithm.
Parameter buf
The buffer.
Parameter options
The compression options.
Package Files (7)
Dependencies (1)
Dev Dependencies (0)
No dev dependencies.
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@types/mz
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@types/mz)
- HTML<a href="https://www.jsdocs.io/package/@types/mz"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 5859 ms. - Missing or incorrect documentation? Open an issue for this package.