Comparing version 0.0.32 to 2.7.0
@@ -1,28 +0,130 @@ | ||
// Type definitions for mz | ||
// Project: https://github.com/normalize/mz | ||
// Definitions by: Thomas Hickman <https://github.com/ThomasHickman> | ||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | ||
// Modified from the node.js definitions. | ||
// https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/node/child_process.d.ts | ||
// Modified from the node.js definitions https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/node/node.d.ts | ||
import { | ||
ChildProcess, | ||
ExecException, | ||
ExecOptions, | ||
ExecFileOptions, | ||
ExecFileOptionsWithStringEncoding, | ||
} from "child_process"; | ||
export * from "child_process"; | ||
/// <reference types="node" /> | ||
export function exec( | ||
command: string, | ||
callback: (error: ExecException | null, stdout: string, stderr: string) => void | ||
): ChildProcess; | ||
export function exec( | ||
command: string, | ||
options: { encoding: "buffer" | null | undefined } & ExecOptions, | ||
callback: (error: ExecException | null, stdout: Buffer, stderr: Buffer) => void | ||
): ChildProcess; | ||
export function exec( | ||
command: string, | ||
options: ({ encoding?: BufferEncoding } & ExecOptions) | null | undefined, | ||
callback: (error: ExecException | null, stdout: string, stderr: string) => void | ||
): ChildProcess; | ||
export function exec( | ||
command: string, | ||
options: ({ encoding?: string | null } & ExecOptions) | null | undefined, | ||
callback: (error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void | ||
): ChildProcess; | ||
import * as child_process from "child_process"; | ||
export * from "child_process"; | ||
export function exec( | ||
command: string, | ||
options: { encoding: "buffer" | null | undefined } & ExecOptions | ||
): Promise<[Buffer, Buffer]>; | ||
export function exec( | ||
command: string, | ||
options?: ({ encoding?: BufferEncoding } & ExecOptions) | null | ||
): Promise<[string, string]>; | ||
export function exec( | ||
command: string, | ||
options?: ({ encoding?: string | null } & ExecOptions) | null | ||
): Promise<[string | Buffer, string | Buffer]>; | ||
export function exec(command: string, callback: (error: Error, stdout: string, stderr: string) => void): child_process.ChildProcess; | ||
export function exec(command: string, options: child_process.ExecOptionsWithBufferEncoding, callback: (error: Error, stdout: Buffer, stderr: Buffer) => void): child_process.ChildProcess; | ||
export function exec(command: string, options: child_process.ExecOptionsWithStringEncoding | child_process.ExecOptions | undefined | null, callback: (error: Error, stdout: string, stderr: string) => void): child_process.ChildProcess; | ||
export function exec(command: string, options: child_process.ExecOptionsWithBufferEncoding): Promise<[Buffer, Buffer]>; | ||
export function exec(command: string, options?: child_process.ExecFileOptionsWithStringEncoding | child_process.ExecOptions | null): Promise<[Buffer, Buffer]>; | ||
interface ExecFileOptionsWithBufferEncoding extends ExecFileOptions { | ||
encoding: "buffer" | null | undefined; | ||
} | ||
export function execFile(file: string, callback: (error: Error, stdout: string, stderr: string) => void): child_process.ChildProcess; | ||
export function execFile(file: string, args: string[] | null | undefined, callback: (error: Error, stdout: string, stderr: string) => void): child_process.ChildProcess; | ||
export function execFile(file: string, args: string[] | null | undefined, options: child_process.ExecFileOptionsWithBufferEncoding, callback: (error: Error, stdout: Buffer, stderr: Buffer) => void): child_process.ChildProcess; | ||
export function execFile(file: string, args: string[] | null | undefined, options: child_process.ExecFileOptionsWithStringEncoding | child_process.ExecFileOptions | undefined | null, callback: (error: Error, stdout: string, stderr: string) => void): child_process.ChildProcess; | ||
export function execFile(file: string, args: string[] | null | undefined, options: child_process.ExecFileOptionsWithBufferEncoding): Promise<[Buffer, Buffer]>; | ||
export function execFile(file: string, args: string[] | null | undefined, options?: child_process.ExecFileOptionsWithStringEncoding | child_process.ExecFileOptions | null): Promise<[string, string]>; | ||
export function execFile(file: string, options: child_process.ExecFileOptionsWithBufferEncoding, callback: (error: Error, stdout: Buffer, stderr: Buffer) => void): child_process.ChildProcess; | ||
export function execFile(file: string, options: child_process.ExecFileOptionsWithStringEncoding | child_process.ExecFileOptions | undefined | null, callback: (error: Error, stdout: string, stderr: string) => void): child_process.ChildProcess; | ||
export function execFile(file: string, options: child_process.ExecFileOptionsWithBufferEncoding): Promise<[Buffer, Buffer]>; | ||
export function execFile(file: string, options?: child_process.ExecFileOptionsWithStringEncoding | child_process.ExecFileOptions | null): Promise<[string, string]>; | ||
interface ExecFileOptionsWithOtherEncoding extends ExecFileOptions { | ||
encoding?: string | null; | ||
} | ||
// no `options` definitely means stdout/stderr are `string`. | ||
export function execFile( | ||
file: string, | ||
callback: (error: Error | null, stdout: string, stderr: string) => void | ||
): ChildProcess; | ||
export function execFile( | ||
file: string, | ||
args: ReadonlyArray<string> | null | undefined, | ||
callback: (error: Error | null, stdout: string, stderr: string) => void | ||
): ChildProcess; | ||
// `options` with `"buffer"` or `null` for `encoding` means stdout/stderr are definitely `Buffer`. | ||
export function execFile( | ||
file: string, | ||
options: ExecFileOptionsWithBufferEncoding, | ||
callback: (error: Error | null, stdout: Buffer, stderr: Buffer) => void | ||
): ChildProcess; | ||
export function execFile( | ||
file: string, | ||
args: ReadonlyArray<string> | null | undefined, | ||
options: ExecFileOptionsWithBufferEncoding, | ||
callback: (error: Error | null, stdout: Buffer, stderr: Buffer) => void | ||
): ChildProcess; | ||
// `options` without an or with a well known `encoding` means stdout/stderr are definitely `string`. | ||
export function execFile( | ||
file: string, | ||
// `options` can't be mixed into `args` | ||
// tslint:disable-next-line: unified-signatures | ||
options: ExecFileOptions | ExecFileOptionsWithStringEncoding, | ||
callback: (error: Error | null, stdout: string, stderr: string) => void | ||
): ChildProcess; | ||
export function execFile( | ||
file: string, | ||
args: ReadonlyArray<string> | null | undefined, | ||
options: ExecFileOptions | ExecFileOptionsWithStringEncoding, | ||
callback: (error: Error | null, stdout: string, stderr: string) => void | ||
): ChildProcess; | ||
// `options` with an `encoding` whose type is `string` means stdout/stderr could either be `Buffer` or `string`. | ||
// There is no guarantee the `encoding` is unknown as `string` is a superset of `BufferEncoding`. | ||
export function execFile( | ||
file: string, | ||
options: ExecFileOptionsWithOtherEncoding | null | undefined, | ||
callback: (error: Error | null, stdout: string | Buffer, stderr: string | Buffer) => void | ||
): ChildProcess; | ||
export function execFile( | ||
file: string, | ||
args: ReadonlyArray<string> | null | undefined, | ||
options: ExecFileOptionsWithOtherEncoding | null | undefined, | ||
callback: (error: Error | null, stdout: string | Buffer, stderr: string | Buffer) => void | ||
): ChildProcess; | ||
export function execFile( | ||
file: string, | ||
args: string[] | null | undefined, | ||
options: ExecFileOptionsWithBufferEncoding | ||
): Promise<[Buffer, Buffer]>; | ||
export function execFile(file: string, options: ExecFileOptionsWithBufferEncoding): Promise<[Buffer, Buffer]>; | ||
export function execFile( | ||
file: string, | ||
args?: string[] | null, | ||
options?: ExecFileOptions | ExecFileOptionsWithStringEncoding | null | ||
): Promise<[string, string]>; | ||
export function execFile( | ||
file: string, | ||
options?: ExecFileOptions | ExecFileOptionsWithStringEncoding | null | ||
): Promise<[string, string]>; | ||
export function execFile( | ||
file: string, | ||
args?: string[] | null, | ||
options?: ExecFileOptionsWithOtherEncoding | null | ||
): Promise<[string | Buffer, string | Buffer]>; | ||
export function execFile( | ||
file: string, | ||
options?: ExecFileOptionsWithOtherEncoding | null | ||
): Promise<[string | Buffer, string | Buffer]>; |
@@ -1,20 +0,27 @@ | ||
// Type definitions for mz | ||
// Project: https://github.com/normalize/mz | ||
// Definitions by: Thomas Hickman <https://github.com/ThomasHickman>, Ron Buckton <https://github.com/rbuckton> | ||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | ||
// Modified from the node.js definitions. | ||
// https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/node/crypto.d.ts | ||
// Modified from the node.js definitions https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/node/node.d.ts | ||
/// <reference types="node" /> | ||
import * as crypto from "crypto"; | ||
import { BinaryLike } from "crypto"; | ||
export * from "crypto"; | ||
export function pbkdf2(password: string | Buffer, salt: string | Buffer, iterations: number, keylen: number, digest: string, callback: (err: Error, derivedKey: Buffer) => any): void; | ||
export function pbkdf2(password: string | Buffer, salt: string | Buffer, iterations: number, keylen: number, digest?: string): Promise<Buffer>; | ||
export function pbkdf2( | ||
password: BinaryLike, | ||
salt: BinaryLike, | ||
iterations: number, | ||
keylen: number, | ||
digest: string, | ||
callback: (err: Error | null, derivedKey: Buffer) => any | ||
): void; | ||
export function pbkdf2( | ||
password: BinaryLike, | ||
salt: BinaryLike, | ||
iterations: number, | ||
keylen: number, | ||
digest: string | ||
): Promise<Buffer>; | ||
export function randomBytes(size: number, callback: (err: Error, buf: Buffer) => void): void; | ||
export function randomBytes(size: number, callback: (err: Error | null, buf: Buffer) => void): void; | ||
export function randomBytes(size: number): Promise<Buffer>; | ||
export function pseudoRandomBytes(size: number, callback: (err: Error, buf: Buffer) => void): void; | ||
export function pseudoRandomBytes(size: number): Promise<Buffer>; | ||
export function pseudoRandomBytes(size: number, callback: (err: Error | null, buf: Buffer) => void): void; | ||
export function pseudoRandomBytes(size: number): Promise<Buffer>; |
232
mz/dns.d.ts
@@ -1,43 +0,215 @@ | ||
// Type definitions for mz | ||
// Project: https://github.com/normalize/mz | ||
// Definitions by: Thomas Hickman <https://github.com/ThomasHickman>, Ron Buckton <https://github.com/rbuckton> | ||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | ||
// Modified from the node.js definitions. | ||
// https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/node/dns.d.ts | ||
// Modified from the node.js definitions https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/node/node.d.ts | ||
import { | ||
LookupAddress, | ||
LookupAllOptions, | ||
LookupOneOptions, | ||
LookupOptions, | ||
ResolveOptions, | ||
ResolveWithTtlOptions, | ||
AnyRecord, | ||
MxRecord, | ||
NaptrRecord, | ||
SoaRecord, | ||
SrvRecord, | ||
RecordWithTtl, | ||
} from "dns"; | ||
export * from "dns"; | ||
/// <reference types="node" /> | ||
// lookup: | ||
export function lookup( | ||
hostname: string, | ||
family: number, | ||
callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void | ||
): void; | ||
export function lookup( | ||
hostname: string, | ||
// `options` can't be mixed into `family` | ||
// tslint:disable-next-line: unified-signatures | ||
options: LookupOneOptions, | ||
callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void | ||
): void; | ||
export function lookup( | ||
hostname: string, | ||
options: LookupAllOptions, | ||
callback: (err: NodeJS.ErrnoException | null, addresses: LookupAddress[]) => void | ||
): void; | ||
export function lookup( | ||
hostname: string, | ||
options: LookupOptions, | ||
callback: (err: NodeJS.ErrnoException | null, address: string | LookupAddress[], family: number) => void | ||
): void; | ||
export function lookup( | ||
hostname: string, | ||
callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void | ||
): void; | ||
import * as dns from "dns"; | ||
export * from "dns"; | ||
export function lookup(hostname: string, options: LookupAllOptions): Promise<LookupAddress[]>; | ||
export function lookup(hostname: string, options?: LookupOneOptions | number): Promise<[string, number]>; | ||
export function lookup(hostname: string, options: LookupOptions): Promise<[string, number] | LookupAddress[]>; | ||
export function lookup(domain: string, family: number, callback: (err: Error, address: string, family: number) => void): void; | ||
export function lookup(domain: string, callback: (err: Error, address: string, family: number) => void): void; | ||
export function lookup(domain: string, family?: number): Promise<[string, number]>; | ||
export function lookupService( | ||
address: string, | ||
port: number, | ||
callback: (err: NodeJS.ErrnoException | null, hostname: string, service: string) => void | ||
): void; | ||
export function lookupService(address: string, port: number): Promise<[string, string]>; | ||
export function resolve(domain: string, rrtype: string, callback: (err: Error, addresses: string[]) => void): void; | ||
export function resolve(domain: string, callback: (err: Error, addresses: string[]) => void): void; | ||
export function resolve(domain: string, rrtype?: string): Promise<string[]>; | ||
// resolve: | ||
export function resolve( | ||
hostname: string, | ||
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void | ||
): void; | ||
export function resolve( | ||
hostname: string, | ||
rrtype: "A" | "AAAA" | "CNAME" | "NS" | "PTR", | ||
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void | ||
): void; | ||
export function resolve( | ||
hostname: string, | ||
rrtype: "ANY", | ||
callback: (err: NodeJS.ErrnoException | null, addresses: AnyRecord[]) => void | ||
): void; | ||
export function resolve( | ||
hostname: string, | ||
rrtype: "MX", | ||
callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void | ||
): void; | ||
export function resolve( | ||
hostname: string, | ||
rrtype: "NAPTR", | ||
callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void | ||
): void; | ||
export function resolve( | ||
hostname: string, | ||
rrtype: "SOA", | ||
callback: (err: NodeJS.ErrnoException | null, addresses: SoaRecord) => void | ||
): void; | ||
export function resolve( | ||
hostname: string, | ||
rrtype: "SRV", | ||
callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void | ||
): void; | ||
export function resolve( | ||
hostname: string, | ||
rrtype: "TXT", | ||
callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void | ||
): void; | ||
export function resolve( | ||
hostname: string, | ||
rrtype: string, | ||
callback: ( | ||
err: NodeJS.ErrnoException | null, | ||
addresses: string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[] | ||
) => void | ||
): void; | ||
export function resolve4(domain: string, callback: (err: Error, addresses: string[]) => void): void; | ||
export function resolve4(domain: string): Promise<string[]>; | ||
export function resolve(hostname: string, rrtype?: "A" | "AAAA" | "CNAME" | "NS" | "PTR"): Promise<string[]>; | ||
export function resolve(hostname: string, rrtype: "ANY"): Promise<AnyRecord[]>; | ||
export function resolve(hostname: string, rrtype: "MX"): Promise<MxRecord[]>; | ||
export function resolve(hostname: string, rrtype: "NAPTR"): Promise<NaptrRecord[]>; | ||
export function resolve(hostname: string, rrtype: "SOA"): Promise<SoaRecord>; | ||
export function resolve(hostname: string, rrtype: "SRV"): Promise<SrvRecord[]>; | ||
export function resolve(hostname: string, rrtype: "TXT"): Promise<string[][]>; | ||
export function resolve( | ||
hostname: string, | ||
rrtype: string | ||
): Promise<string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[]>; | ||
export function resolve6(domain: string, callback: (err: Error, addresses: string[]) => void): void; | ||
export function resolve6(domain: string): Promise<string[]>; | ||
// resolve4: | ||
export function resolve4( | ||
hostname: string, | ||
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void | ||
): void; | ||
export function resolve4( | ||
hostname: string, | ||
options: ResolveWithTtlOptions, | ||
callback: (err: NodeJS.ErrnoException | null, addresses: RecordWithTtl[]) => void | ||
): void; | ||
export function resolve4( | ||
hostname: string, | ||
options: ResolveOptions, | ||
callback: (err: NodeJS.ErrnoException | null, addresses: string[] | RecordWithTtl[]) => void | ||
): void; | ||
export function resolveMx(domain: string, callback: (err: Error, addresses: dns.MxRecord[]) => void): void; | ||
export function resolveMx(domain: string): Promise<dns.MxRecord[]>; | ||
export function resolve4(hostname: string): Promise<string[]>; | ||
export function resolve4(hostname: string, options: ResolveWithTtlOptions): Promise<RecordWithTtl[]>; | ||
export function resolve4(hostname: string, options?: ResolveOptions): Promise<string[] | RecordWithTtl[]>; | ||
export function resolveTxt(domain: string, callback: (err: Error, addresses: string[]) => void): void; | ||
export function resolveTxt(domain: string): Promise<string[]>; | ||
// resolve6: | ||
export function resolve6( | ||
hostname: string, | ||
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void | ||
): void; | ||
export function resolve6( | ||
hostname: string, | ||
options: ResolveWithTtlOptions, | ||
callback: (err: NodeJS.ErrnoException | null, addresses: RecordWithTtl[]) => void | ||
): void; | ||
export function resolve6( | ||
hostname: string, | ||
options: ResolveOptions, | ||
callback: (err: NodeJS.ErrnoException | null, addresses: string[] | RecordWithTtl[]) => void | ||
): void; | ||
export function resolveSrv(domain: string, callback: (err: Error, addresses: string[]) => void): void; | ||
export function resolveSrv(domain: string): Promise<string[]>; | ||
export function resolve6(hostname: string): Promise<string[]>; | ||
export function resolve6(hostname: string, options: ResolveWithTtlOptions): Promise<RecordWithTtl[]>; | ||
export function resolve6(hostname: string, options?: ResolveOptions): Promise<string[] | RecordWithTtl[]>; | ||
export function resolveNs(domain: string, callback: (err: Error, addresses: string[]) => void): void; | ||
export function resolveNs(domain: string): Promise<string[]>; | ||
export function resolveCname( | ||
hostname: string, | ||
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void | ||
): void; | ||
export function resolveCname(hostname: string): Promise<string[]>; | ||
export function resolveCname(domain: string, callback: (err: Error, addresses: string[]) => void): void; | ||
export function resolveCname(domain: string): Promise<string[]>; | ||
export function resolveMx( | ||
hostname: string, | ||
callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void | ||
): void; | ||
export function resolveMx(hostname: string): Promise<MxRecord[]>; | ||
export function reverse(ip: string, callback: (err: Error, domains: string[]) => void): void; | ||
export function reverse(ip: string): Promise<string[]>; | ||
export function resolveNaptr( | ||
hostname: string, | ||
callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void | ||
): void; | ||
export function resolveNaptr(hostname: string): Promise<NaptrRecord[]>; | ||
export function resolveNs( | ||
hostname: string, | ||
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void | ||
): void; | ||
export function resolveNs(hostname: string): Promise<string[]>; | ||
export function resolvePtr( | ||
hostname: string, | ||
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void | ||
): void; | ||
export function resolvePtr(hostname: string): Promise<string[]>; | ||
export function resolveSoa( | ||
hostname: string, | ||
callback: (err: NodeJS.ErrnoException | null, address: SoaRecord) => void | ||
): void; | ||
export function resolveSoa(hostname: string): Promise<SoaRecord>; | ||
export function resolveSrv( | ||
hostname: string, | ||
callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void | ||
): void; | ||
export function resolveSrv(hostname: string): Promise<SrvRecord[]>; | ||
export function resolveTxt( | ||
hostname: string, | ||
callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void | ||
): void; | ||
export function resolveTxt(hostname: string): Promise<string[][]>; | ||
export function resolveAny( | ||
hostname: string, | ||
callback: (err: NodeJS.ErrnoException | null, addresses: AnyRecord[]) => void | ||
): void; | ||
export function resolveAny(hostname: string): Promise<AnyRecord[]>; | ||
export function reverse(ip: string, callback: (err: NodeJS.ErrnoException | null, domains: string[]) => void): void; | ||
export function reverse(ip: string): Promise<string[]>; |
1280
mz/fs.d.ts
@@ -1,11 +0,15 @@ | ||
// Type definitions for mz | ||
// Project: https://github.com/normalize/mz | ||
// Definitions by: Thomas Hickman <https://github.com/ThomasHickman>, Ron Buckton <https://github.com/rbuckton> | ||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | ||
// Modified from the node.js definitions. | ||
// https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/node/fs.d.ts | ||
// Modified from the node.js definitions https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/node/node.d.ts | ||
/// <reference types="node" /> | ||
import * as fs from "fs"; | ||
import { | ||
Dirent, | ||
FSWatcher, | ||
NoParamCallback, | ||
PathLike, | ||
RmDirAsyncOptions, | ||
WriteFileOptions, | ||
Stats, | ||
symlink as symlinkNS, | ||
MakeDirectoryOptions, | ||
} from "fs"; | ||
export * from "fs"; | ||
@@ -15,9 +19,23 @@ | ||
* Asynchronous `rename(2)`. | ||
* | ||
* Change the name or location of a file or directory. | ||
* | ||
* @param oldPath A path to a file. If a URL is provided, it must use the `file:` protocol. | ||
* URL support is _experimental_. | ||
* @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol. | ||
* URL support is _experimental_. | ||
*/ | ||
export function rename(oldPath: string, newPath: string, callback: (err?: NodeJS.ErrnoException) => void): void; | ||
export function rename(oldPath: PathLike, newPath: PathLike, callback: NoParamCallback): void; | ||
/** | ||
* Asynchronous `rename(2)`. | ||
* | ||
* Change the name or location of a file or directory. | ||
* | ||
* @param oldPath A path to a file. If a URL is provided, it must use the `file:` protocol. | ||
* URL support is _experimental_. | ||
* @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol. | ||
* URL support is _experimental_. | ||
*/ | ||
export function rename(oldPath: string, newPath: string): Promise<void>; | ||
export function rename(oldPath: PathLike, newPath: PathLike): Promise<void>; | ||
@@ -27,5 +45,8 @@ /** | ||
* | ||
* If the file was larger than `len` bytes, only the first `len` bytes will be retained in the file. | ||
* Truncate a file to a specified length. | ||
* | ||
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol. | ||
* @param len If not specified, defaults to `0`. | ||
*/ | ||
export function truncate(path: string | Buffer, len: number, callback: (err?: NodeJS.ErrnoException) => void): void; | ||
export function truncate(path: PathLike, len: number | null | undefined, callback: NoParamCallback): void; | ||
@@ -35,5 +56,8 @@ /** | ||
* | ||
* If the file was larger than `len` bytes, only the first `len` bytes will be retained in the file. | ||
* Truncate a file to a specified length. | ||
* | ||
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol. | ||
* URL support is _experimental_. | ||
*/ | ||
export function truncate(path: string | Buffer, callback: (err?: NodeJS.ErrnoException) => void): void; | ||
export function truncate(path: PathLike, callback: NoParamCallback): void; | ||
@@ -43,5 +67,8 @@ /** | ||
* | ||
* If the file was larger than `len` bytes, only the first `len` bytes will be retained in the file. | ||
* Truncate a file to a specified length. | ||
* | ||
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol. | ||
* @param len If not specified, defaults to `0`. | ||
*/ | ||
export function truncate(path: string | Buffer, len?: number): Promise<void>; | ||
export function truncate(path: PathLike, len?: number | null): Promise<void>; | ||
@@ -51,11 +78,17 @@ /** | ||
* | ||
* If the file referred to by the file descriptor was larger than `len` bytes, only the first `len` | ||
* bytes will be retained in the file. | ||
* Truncate a file to a specified length. | ||
* | ||
* @param fd A file descriptor. | ||
* @param len If not specified, defaults to `0`. | ||
*/ | ||
export function ftruncate(fd: number, len: number, callback: (err?: NodeJS.ErrnoException) => void): void; | ||
export function ftruncate(fd: number, len: number | null | undefined, callback: NoParamCallback): void; | ||
/** | ||
* Asynchronous `ftruncate(2)`. | ||
* | ||
* Truncate a file to a specified length. | ||
* | ||
* @param fd A file descriptor. | ||
*/ | ||
export function ftruncate(fd: number, callback: (err?: NodeJS.ErrnoException) => void): void; | ||
export function ftruncate(fd: number, callback: NoParamCallback): void; | ||
@@ -65,24 +98,43 @@ /** | ||
* | ||
* If the file referred to by the file descriptor was larger than `len` bytes, only the first `len` | ||
* bytes will be retained in the file. | ||
* Truncate a file to a specified length. | ||
* | ||
* @param fd A file descriptor. | ||
* @param len If not specified, defaults to `0`. | ||
*/ | ||
export function ftruncate(fd: number, len?: number): Promise<void>; | ||
export function ftruncate(fd: number, len?: number | null): Promise<void>; | ||
/** | ||
* Asynchronous `chown(2)`. | ||
* | ||
* Change ownership of a file. | ||
* | ||
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol. | ||
*/ | ||
export function chown(path: string | Buffer, uid: number, gid: number, callback: (err?: NodeJS.ErrnoException) => void): void; | ||
export function chown(path: PathLike, uid: number, gid: number, callback: NoParamCallback): void; | ||
/** | ||
* Asynchronous `chown(2)`. | ||
* | ||
* Change ownership of a file. | ||
* | ||
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol. | ||
*/ | ||
export function chown(path: string | Buffer, uid: number, gid: number): Promise<void>; | ||
export function chown(path: PathLike, uid: number, gid: number): Promise<void>; | ||
/** | ||
* Asynchronous `fchown(2)`. | ||
* | ||
* Change ownership of a file. | ||
* | ||
* @param fd A file descriptor. | ||
*/ | ||
export function fchown(fd: number, uid: number, gid: number, callback: (err?: NodeJS.ErrnoException) => void): void; | ||
export function fchown(fd: number, uid: number, gid: number, callback: NoParamCallback): void; | ||
export function fchown(fd: number, uid: number, gid: number, callback: NoParamCallback): void; | ||
/** | ||
* Asynchronous `fchown(2)`. | ||
* | ||
* Change ownership of a file. | ||
* | ||
* @param fd A file descriptor. | ||
*/ | ||
@@ -92,28 +144,56 @@ export function fchown(fd: number, uid: number, gid: number): Promise<void>; | ||
/** | ||
* (Deprecated) Asynchronous `lchown(2)`. | ||
* Asynchronous `lchown(2)`. | ||
* | ||
* Change ownership of a file. Does not dereference symbolic links. | ||
* | ||
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol. | ||
*/ | ||
export function lchown(path: string | Buffer, uid: number, gid: number, callback: (err?: NodeJS.ErrnoException) => void): void; | ||
export function lchown(path: PathLike, uid: number, gid: number, callback: NoParamCallback): void; | ||
/** | ||
* (Deprecated) Asynchronous `lchown(2)`. | ||
* Asynchronous `lchown(2)`. | ||
* | ||
* Change ownership of a file. Does not dereference symbolic links. | ||
* | ||
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol. | ||
*/ | ||
export function lchown(path: string | Buffer, uid: number, gid: number): Promise<void>; | ||
export function lchown(path: PathLike, uid: number, gid: number): Promise<void>; | ||
/** | ||
* Asynchronous `chmod(2)`. | ||
* | ||
* Change permissions of a file. | ||
* | ||
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol. | ||
* @param mode A file mode. If a string is passed, it is parsed as an octal integer. | ||
*/ | ||
export function chmod(path: string | Buffer, mode: string | number, callback: (err?: NodeJS.ErrnoException) => void): void; | ||
export function chmod(path: PathLike, mode: string | number, callback: NoParamCallback): void; | ||
/** | ||
* Asynchronous `chmod(2)`. | ||
* | ||
* Change permissions of a file. | ||
* | ||
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol. | ||
* @param mode A file mode. If a string is passed, it is parsed as an octal integer. | ||
*/ | ||
export function chmod(path: string | Buffer, mode: string | number): Promise<void>; | ||
export function chmod(path: PathLike, mode: string | number): Promise<void>; | ||
/** | ||
* Asynchronous `fchmod(2)`. | ||
* | ||
* Change permissions of a file. | ||
* | ||
* @param fd A file descriptor. | ||
* @param mode A file mode. If a string is passed, it is parsed as an octal integer. | ||
*/ | ||
export function fchmod(fd: number, mode: string | number, callback: (err?: NodeJS.ErrnoException) => void): void; | ||
export function fchmod(fd: number, mode: string | number, callback: NoParamCallback): void; | ||
/** | ||
* Asynchronous `fchmod(2)`. | ||
* | ||
* Change permissions of a file. | ||
* | ||
* @param fd A file descriptor. | ||
* @param mode A file mode. If a string is passed, it is parsed as an octal integer. | ||
*/ | ||
@@ -123,104 +203,357 @@ export function fchmod(fd: number, mode: string | number): Promise<void>; | ||
/** | ||
* (Deprecated) Asynchronous `lchmod(2)`. | ||
* Asynchronous `lchmod(2)`. | ||
* | ||
* NOTE: Only available on Mac OS X. | ||
* Change permissions of a file. Does not dereference symbolic links. | ||
* | ||
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol. | ||
* @param mode A file mode. If a string is passed, it is parsed as an octal integer. | ||
*/ | ||
export function lchmod(path: string | Buffer, mode: string | number, callback: (err?: NodeJS.ErrnoException) => void): void; | ||
export function lchmod(path: PathLike, mode: string | number, callback: NoParamCallback): void; | ||
/** | ||
* (Deprecated) Asynchronous `lchmod(2)`. | ||
* Asynchronous `lchmod(2)`. | ||
* | ||
* NOTE: Only available on Mac OS X. | ||
* Change permissions of a file. Does not dereference symbolic links. | ||
* | ||
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol. | ||
* @param mode A file mode. If a string is passed, it is parsed as an octal integer. | ||
*/ | ||
export function lchmod(path: string | Buffer, mode: string | number): Promise<void>; | ||
export function lchmod(path: PathLike, mode: string | number): Promise<void>; | ||
/** | ||
* Asynchronous `stat(2)`. | ||
* | ||
* Get file status. | ||
* | ||
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol. | ||
*/ | ||
export function stat(path: string | Buffer, callback: (err: NodeJS.ErrnoException, stats: fs.Stats) => any): void; | ||
export function stat(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void; | ||
/** | ||
* Asynchronous `stat(2)`. | ||
* | ||
* Get file status. | ||
* | ||
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol. | ||
*/ | ||
export function stat(path: string | Buffer): Promise<fs.Stats>; | ||
export function stat(path: PathLike): Promise<Stats>; | ||
/** | ||
* Asynchronous `lstat(2)`. | ||
* Asynchronous `fstat(2)`. | ||
* | ||
* `lstat()` is identical to `stat()`, except that if path is a symbolic link, then the link itself | ||
* is stat-ed, not the file that it refers to. | ||
* Get file status. | ||
* | ||
* @param fd A file descriptor. | ||
*/ | ||
export function lstat(path: string | Buffer, callback: (err: NodeJS.ErrnoException, stats: fs.Stats) => any): void; | ||
export function fstat(fd: number, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void; | ||
/** | ||
* Asynchronous `lstat(2)`. | ||
* Asynchronous `fstat(2)`. | ||
* | ||
* `lstat()` is identical to `stat()`, except that if path is a symbolic link, then the link itself | ||
* is stat-ed, not the file that it refers to. | ||
* Get file status. | ||
* | ||
* @param fd A file descriptor. | ||
*/ | ||
export function lstat(path: string | Buffer): Promise<fs.Stats>; | ||
export function fstat(fd: number): Promise<Stats>; | ||
/** | ||
* Asynchronous `fstat(2)`. | ||
* Synchronous fstat(2) - Get file status. | ||
* @param fd A file descriptor. | ||
*/ | ||
export function fstat(fd: number, callback: (err: NodeJS.ErrnoException, stats: fs.Stats) => any): void; | ||
export function fstatSync(fd: number): Stats; | ||
/** | ||
* Asynchronous `fstat(2)`. | ||
* Asynchronous `lstat(2)`. | ||
* | ||
* Get file status. Does not dereference symbolic links. | ||
* | ||
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol. | ||
*/ | ||
export function fstat(fd: number): Promise<fs.Stats>; | ||
export function lstat(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void; | ||
/** | ||
* Asynchronous `lstat(2)`. | ||
* | ||
* Get file status. Does not dereference symbolic links. | ||
* | ||
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol. | ||
*/ | ||
export function lstat(path: PathLike): Promise<Stats>; | ||
/** | ||
* Asynchronous `link(2)`. | ||
* | ||
* Create a new link (also known as a hard link) to an existing file. | ||
* | ||
* @param existingPath A path to a file. If a URL is provided, it must use the `file:` protocol. | ||
* @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol. | ||
*/ | ||
export function link(srcpath: string | Buffer, dstpath: string | Buffer, callback: (err?: NodeJS.ErrnoException) => void): void; | ||
export function link(existingPath: PathLike, newPath: PathLike, callback: NoParamCallback): void; | ||
/** | ||
* Asynchronous `link(2)`. | ||
* | ||
* Create a new link (also known as a hard link) to an existing file. | ||
* | ||
* @param existingPath A path to a file. If a URL is provided, it must use the `file:` protocol. | ||
* @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol. | ||
*/ | ||
export function link(srcpath: string | Buffer, dstpath: string | Buffer): Promise<void>; | ||
export function link(existingPath: PathLike, newPath: PathLike): Promise<void>; | ||
/** | ||
* Asynchronous `symlink(2)`. | ||
* | ||
* Create a new symbolic link to an existing file. | ||
* | ||
* @param target A path to an existing file. If a URL is provided, it must use the `file:` protocol. | ||
* @param path A path to the new symlink. If a URL is provided, it must use the `file:` protocol. | ||
* @param 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'`, the `target` argument will automatically be normalized to an absolute path. | ||
*/ | ||
export function symlink(srcpath: string | Buffer, dstpath: string | Buffer, type: string, callback: (err?: NodeJS.ErrnoException) => void): void; | ||
export function symlink( | ||
target: PathLike, | ||
path: PathLike, | ||
type: symlinkNS.Type | null | undefined, | ||
callback: NoParamCallback | ||
): void; | ||
/** | ||
* Asynchronous `symlink(2)`. | ||
* | ||
* Create a new symbolic link to an existing file. | ||
* | ||
* @param target A path to an existing file. If a URL is provided, it must use the `file:` protocol. | ||
* @param path A path to the new symlink. If a URL is provided, it must use the `file:` protocol. | ||
*/ | ||
export function symlink(srcpath: string | Buffer, dstpath: string | Buffer, callback: (err?: NodeJS.ErrnoException) => void): void; | ||
export function symlink(target: PathLike, path: PathLike, callback: NoParamCallback): void; | ||
/** | ||
* Asynchronous `symlink(2)`. | ||
* | ||
* Create a new symbolic link to an existing file. | ||
* | ||
* @param target A path to an existing file. If a URL is provided, it must use the `file:` protocol. | ||
* @param path A path to the new symlink. If a URL is provided, it must use the `file:` protocol. | ||
* @param 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'`, the `target` argument will automatically be normalized to an absolute path. | ||
*/ | ||
export function symlink(srcpath: string | Buffer, dstpath: string | Buffer, type?: string): Promise<void>; | ||
export function symlink(target: PathLike, path: PathLike, type?: string | null): Promise<void>; | ||
/** | ||
* Asynchronous `readlink(2)`. | ||
* | ||
* read value of a symbolic link. | ||
* | ||
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol. | ||
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. | ||
*/ | ||
export function readlink(path: string | Buffer, callback: (err: NodeJS.ErrnoException, linkString: string) => any): void; | ||
export function readlink( | ||
path: PathLike, | ||
options: { encoding?: BufferEncoding | null } | BufferEncoding | null | undefined, | ||
callback: (err: NodeJS.ErrnoException | null, linkString: string) => void | ||
): void; | ||
/** | ||
* Asynchronous `readlink(2)`. | ||
* | ||
* read value of a symbolic link. | ||
* | ||
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol. | ||
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. | ||
*/ | ||
export function readlink(path: string | Buffer): Promise<string>; | ||
export function readlink( | ||
path: PathLike, | ||
options: { encoding: "buffer" } | "buffer", | ||
callback: (err: NodeJS.ErrnoException | null, linkString: Buffer) => void | ||
): void; | ||
/** | ||
* Asynchronous `readlink(2)`. | ||
* | ||
* read value of a symbolic link. | ||
* | ||
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol. | ||
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. | ||
*/ | ||
export function readlink( | ||
path: PathLike, | ||
options: { encoding?: string | null } | string | null | undefined, | ||
callback: (err: NodeJS.ErrnoException | null, linkString: string | Buffer) => void | ||
): void; | ||
/** | ||
* Asynchronous `readlink(2)`. | ||
* | ||
* read value of a symbolic link. | ||
* | ||
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol. | ||
*/ | ||
export function readlink( | ||
path: PathLike, | ||
callback: (err: NodeJS.ErrnoException | null, linkString: string) => void | ||
): void; | ||
/** | ||
* Asynchronous `readlink(2)`. | ||
* | ||
* read value of a symbolic link. | ||
* | ||
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol. | ||
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. | ||
*/ | ||
export function readlink( | ||
path: PathLike, | ||
options?: { encoding?: BufferEncoding | null } | BufferEncoding | null | ||
): Promise<string>; | ||
/** | ||
* Asynchronous `readlink(2)`. | ||
* | ||
* read value of a symbolic link. | ||
* | ||
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol. | ||
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. | ||
*/ | ||
export function readlink(path: PathLike, options: { encoding: "buffer" } | "buffer"): Promise<Buffer>; | ||
/** | ||
* Asynchronous `readlink(2)`. | ||
* | ||
* read value of a symbolic link. | ||
* | ||
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol. | ||
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. | ||
*/ | ||
export function readlink( | ||
path: PathLike, | ||
options?: { encoding?: string | null } | string | null | ||
): Promise<string | Buffer>; | ||
/** | ||
* Asynchronous `realpath(3)`. | ||
* | ||
* return the canonicalized absolute pathname. | ||
* | ||
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol. | ||
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. | ||
*/ | ||
export function realpath(path: string | Buffer, callback: (err: NodeJS.ErrnoException, resolvedPath: string) => any): void; | ||
export function realpath( | ||
path: PathLike, | ||
options: { encoding?: BufferEncoding | null } | BufferEncoding | null | undefined, | ||
callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void | ||
): void; | ||
/** | ||
* Asynchronous `realpath(3)`. | ||
* | ||
* return the canonicalized absolute pathname. | ||
* | ||
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol. | ||
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. | ||
*/ | ||
export function realpath(path: string | Buffer): Promise<string>; | ||
export function realpath( | ||
path: PathLike, | ||
options: { encoding: "buffer" } | "buffer", | ||
callback: (err: NodeJS.ErrnoException | null, resolvedPath: Buffer) => void | ||
): void; | ||
/** | ||
* Asynchronous `realpath(3)`. | ||
* | ||
* return the canonicalized absolute pathname. | ||
* | ||
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol. | ||
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. | ||
*/ | ||
export function realpath( | ||
path: PathLike, | ||
options: { encoding?: string | null } | string | null | undefined, | ||
callback: (err: NodeJS.ErrnoException | null, resolvedPath: string | Buffer) => void | ||
): void; | ||
/** | ||
* Asynchronous `realpath(3)`. | ||
* | ||
* return the canonicalized absolute pathname. | ||
* | ||
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol. | ||
*/ | ||
export function realpath( | ||
path: PathLike, | ||
callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void | ||
): void; | ||
/** | ||
* Asynchronous `realpath(3)`. | ||
* | ||
* return the canonicalized absolute pathname. | ||
* | ||
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol. | ||
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. | ||
*/ | ||
export function realpath( | ||
path: PathLike, | ||
options?: { encoding?: BufferEncoding | null } | BufferEncoding | null | ||
): Promise<string>; | ||
/** | ||
* Asynchronous `realpath(3)`. | ||
* | ||
* return the canonicalized absolute pathname. | ||
* | ||
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol. | ||
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. | ||
*/ | ||
export function realpath(path: PathLike, options: { encoding: "buffer" } | "buffer"): Promise<Buffer>; | ||
/** | ||
* Asynchronous `realpath(3)`. | ||
* | ||
* return the canonicalized absolute pathname. | ||
* | ||
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol. | ||
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. | ||
*/ | ||
export function realpath( | ||
path: PathLike, | ||
options?: { encoding?: string | null } | string | null | ||
): Promise<string | Buffer>; | ||
export namespace realpath { | ||
function native( | ||
path: PathLike, | ||
options: { encoding?: BufferEncoding | null } | BufferEncoding | null | undefined, | ||
callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void | ||
): void; | ||
function native( | ||
path: PathLike, | ||
options: { encoding: "buffer" } | "buffer", | ||
callback: (err: NodeJS.ErrnoException | null, resolvedPath: Buffer) => void | ||
): void; | ||
function native( | ||
path: PathLike, | ||
options: { encoding?: string | null } | string | null | undefined, | ||
callback: (err: NodeJS.ErrnoException | null, resolvedPath: string | Buffer) => void | ||
): void; | ||
function native(path: PathLike, callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void): void; | ||
function native( | ||
path: PathLike, | ||
options?: { encoding?: BufferEncoding | null } | BufferEncoding | null | ||
): Promise<string>; | ||
function native(path: PathLike, options: { encoding: "buffer" } | "buffer"): Promise<Buffer>; | ||
function native( | ||
path: PathLike, | ||
options: { encoding?: string | null } | string | null | undefined | ||
): Promise<string | Buffer>; | ||
} | ||
/** | ||
* Asynchronous `unlink(2)`. | ||
* | ||
* Deletes the file specified in `path`. | ||
* delete a name and possibly the file it refers to. | ||
* | ||
* @param path The path to a file. | ||
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol. | ||
*/ | ||
export function unlink(path: string | Buffer, callback: (err?: NodeJS.ErrnoException) => void): void; | ||
export function unlink(path: PathLike, callback: NoParamCallback): void; | ||
@@ -230,7 +563,7 @@ /** | ||
* | ||
* Deletes the file specified in `path`. | ||
* delete a name and possibly the file it refers to. | ||
* | ||
* @param path The path to a file. | ||
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol. | ||
*/ | ||
export function unlink(path: string | Buffer): Promise<void>; | ||
export function unlink(path: PathLike): Promise<void>; | ||
@@ -242,7 +575,16 @@ /** | ||
* | ||
* @param path The path to the directory. | ||
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol. | ||
*/ | ||
export function rmdir(path: string | Buffer, callback: (err?: NodeJS.ErrnoException) => void): void; | ||
export function rmdir(path: PathLike, callback: NoParamCallback): void; | ||
/** | ||
* Asynchronous `rmdir(2)`. | ||
* | ||
* Removes the directory specified in `path`. | ||
* | ||
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol. | ||
*/ | ||
export function rmdir(path: PathLike, options: RmDirAsyncOptions, callback: NoParamCallback): void; | ||
/** | ||
* Asynchronous `rmdir(2)` | ||
@@ -252,5 +594,5 @@ * | ||
* | ||
* @param path The path to the directory. | ||
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol. | ||
*/ | ||
export function rmdir(path: string | Buffer): Promise<void>; | ||
export function rmdir(path: PathLike, options?: RmDirAsyncOptions): Promise<void>; | ||
@@ -262,6 +604,11 @@ /** | ||
* | ||
* @param path The path to the directory. | ||
* @param mode The mode for the directory (default: `0777`). | ||
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol. | ||
* @param 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`. | ||
*/ | ||
export function mkdir(path: string | Buffer, mode: string | number, callback: (err?: NodeJS.ErrnoException) => void): void; | ||
export function mkdir( | ||
path: PathLike, | ||
options: number | string | MakeDirectoryOptions | null | undefined, | ||
callback: NoParamCallback | ||
): void; | ||
@@ -271,8 +618,7 @@ /** | ||
* | ||
* Creates the directory specified in `path`. | ||
* Creates the directory with a mode of `0o777`. | ||
* | ||
* @param path The path to the directory. | ||
* @param mode The mode for the directory (default: `0777`). | ||
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol. | ||
*/ | ||
export function mkdir(path: string | Buffer, callback: (err?: NodeJS.ErrnoException) => void): void; | ||
export function mkdir(path: PathLike, callback: NoParamCallback): void; | ||
@@ -284,6 +630,7 @@ /** | ||
* | ||
* @param path The path to the directory. | ||
* @param mode The mode for the directory (default: `0777`). | ||
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol. | ||
* @param 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`. | ||
*/ | ||
export function mkdir(path: string | Buffer, mode?: string | number): Promise<void>; | ||
export function mkdir(path: PathLike, options?: number | string | MakeDirectoryOptions | null): Promise<void>; | ||
@@ -293,6 +640,12 @@ /** | ||
* | ||
* Generates six random characters to be appended behind a required prefix to create a unique temporary directory. | ||
* | ||
* @param prefix temp dir prefix | ||
* @param options "$encoding" or {encoding: "$encoding"} | ||
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. | ||
*/ | ||
export function mkdtemp(prefix: string, options: string | {encoding: string}, callback: (err: NodeJS.ErrnoException | undefined, folder: string) => void): void | ||
export function mkdtemp( | ||
prefix: string, | ||
options: { encoding?: BufferEncoding | null } | BufferEncoding | null | undefined, | ||
callback: (err: NodeJS.ErrnoException | null, folder: string) => void | ||
): void; | ||
@@ -302,6 +655,12 @@ /** | ||
* | ||
* Generates six random characters to be appended behind a required prefix to create a unique temporary directory. | ||
* | ||
* @param prefix temp dir prefix | ||
* @param options "$encoding" or {encoding: "$encoding"} | ||
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. | ||
*/ | ||
export function mkdtemp(prefix: string, callback: (err: NodeJS.ErrnoException | undefined, folder: string) => void): void; | ||
export function mkdtemp( | ||
prefix: string, | ||
options: "buffer" | { encoding: "buffer" }, | ||
callback: (err: NodeJS.ErrnoException | null, folder: Buffer) => void | ||
): void; | ||
@@ -311,13 +670,72 @@ /** | ||
* | ||
* Generates six random characters to be appended behind a required prefix to create a unique temporary directory. | ||
* | ||
* @param prefix temp dir prefix | ||
* @param options "$encoding" or {encoding: "$encoding"} | ||
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. | ||
*/ | ||
export function mkdtemp(prefix: string, options: string | {encoding: string}): Promise<string> | ||
export function mkdtemp( | ||
prefix: string, | ||
options: { encoding?: string | null } | string | null | undefined, | ||
callback: (err: NodeJS.ErrnoException | null, folder: string | Buffer) => void | ||
): void; | ||
/** | ||
* Creates a unique temporary directory. | ||
* | ||
* Generates six random characters to be appended behind a required prefix to create a unique temporary directory. | ||
* | ||
* @param prefix temp dir prefix | ||
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. | ||
*/ | ||
export function mkdtemp(prefix: string, callback: (err: NodeJS.ErrnoException | null, folder: string) => void): void; | ||
/*** | ||
* Creates a unique temporary directory. | ||
* | ||
* Generates six random characters to be appended behind a required prefix to create a unique temporary directory. | ||
* | ||
* @param prefix temp dir prefix | ||
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. | ||
*/ | ||
export function mkdtemp( | ||
prefix: string, | ||
options?: { encoding?: BufferEncoding | null } | BufferEncoding | null | ||
): Promise<string>; | ||
/*** | ||
* Creates a unique temporary directory. | ||
* | ||
* Generates six random characters to be appended behind a required prefix to create a unique temporary directory. | ||
* | ||
* @param prefix temp dir prefix | ||
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. | ||
*/ | ||
export function mkdtemp(prefix: string, options: { encoding: "buffer" } | "buffer"): Promise<Buffer>; | ||
/*** | ||
* Creates a unique temporary directory. | ||
* | ||
* Generates six random characters to be appended behind a required prefix to create a unique temporary directory. | ||
* | ||
* @param prefix temp dir prefix | ||
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. | ||
*/ | ||
export function mkdtemp( | ||
prefix: string, | ||
options?: { encoding?: string | null } | string | null | ||
): Promise<string | Buffer>; | ||
/** | ||
* Asynchronous `readdir(3)`. | ||
* | ||
* Reads the contents of a directory. | ||
* | ||
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol. | ||
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. | ||
*/ | ||
export function readdir(path: string | Buffer, callback: (err: NodeJS.ErrnoException, files: string[]) => void): void; | ||
export function readdir( | ||
path: PathLike, | ||
options: { encoding: BufferEncoding | null; withFileTypes?: false } | BufferEncoding | null | undefined, | ||
callback: (err: NodeJS.ErrnoException | null, files: string[]) => void | ||
): void; | ||
@@ -328,12 +746,113 @@ /** | ||
* Reads the contents of a directory. | ||
* | ||
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol. | ||
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. | ||
*/ | ||
export function readdir(path: string | Buffer): Promise<string[]>; | ||
export function readdir( | ||
path: PathLike, | ||
options: { encoding: "buffer"; withFileTypes?: false } | "buffer", | ||
callback: (err: NodeJS.ErrnoException | null, files: Buffer[]) => void | ||
): void; | ||
/** | ||
* Asynchronous `readdir(3)`. | ||
* | ||
* Reads the contents of a directory. | ||
* | ||
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol. | ||
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. | ||
*/ | ||
export function readdir( | ||
path: PathLike, | ||
options: { encoding?: string | null; withFileTypes?: false } | string | null | undefined, | ||
callback: (err: NodeJS.ErrnoException | null, files: string[] | Buffer[]) => void | ||
): void; | ||
/** | ||
* Asynchronous `readdir(3)`. | ||
* | ||
* Reads the contents of a directory. | ||
* | ||
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol. | ||
*/ | ||
export function readdir(path: PathLike, callback: (err: NodeJS.ErrnoException | null, files: string[]) => void): void; | ||
/** | ||
* Asynchronous `readdir(3)`. | ||
* | ||
* Reads the contents of a directory. | ||
* | ||
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol. | ||
* @param options If called with `withFileTypes: true` the result data will be an array of Dirent. | ||
*/ | ||
export function readdir( | ||
path: PathLike, | ||
options: { encoding?: string | null; withFileTypes: true }, | ||
callback: (err: NodeJS.ErrnoException | null, files: Dirent[]) => void | ||
): void; | ||
/** | ||
* Asynchronous `readdir(3)`. | ||
* | ||
* Reads the contents of a directory. | ||
* | ||
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol. | ||
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. | ||
*/ | ||
export function readdir( | ||
path: PathLike, | ||
options?: { encoding: BufferEncoding | null; withFileTypes?: false } | BufferEncoding | null | ||
): Promise<string[]>; | ||
/** | ||
* Asynchronous `readdir(3)`. | ||
* | ||
* Reads the contents of a directory. | ||
* | ||
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol. | ||
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. | ||
*/ | ||
export function readdir( | ||
path: PathLike, | ||
options: "buffer" | { encoding: "buffer"; withFileTypes?: false } | ||
): Promise<Buffer[]>; | ||
/** | ||
* Asynchronous `readdir(3)`. | ||
* | ||
* Reads the contents of a directory. | ||
* | ||
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol. | ||
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. | ||
*/ | ||
export function readdir( | ||
path: PathLike, | ||
options?: { encoding?: string | null; withFileTypes?: false } | string | null | ||
): Promise<string[] | Buffer[]>; | ||
/** | ||
* Asynchronous `readdir(3)`. | ||
* | ||
* Reads the contents of a directory. | ||
* | ||
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol. | ||
* @param options If called with `withFileTypes: true` the result data will be an array of Dirent | ||
*/ | ||
export function readdir(path: PathLike, options: { encoding?: string | null; withFileTypes: true }): Promise<Dirent[]>; | ||
/** | ||
* Asynchronous `close(2)`. | ||
* | ||
* close a file descriptor. | ||
* | ||
* @param fd A file descriptor. | ||
*/ | ||
export function close(fd: number, callback: (err?: NodeJS.ErrnoException) => void): void; | ||
export function close(fd: number, callback: NoParamCallback): void; | ||
/** | ||
* Asynchronous `close(2)`. | ||
* | ||
* close a file descriptor. | ||
* | ||
* @param fd A file descriptor. | ||
*/ | ||
@@ -344,42 +863,99 @@ export function close(fd: number): Promise<void>; | ||
* Asynchronous `open(2)`. | ||
* | ||
* open and possibly create a file. | ||
* | ||
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol. | ||
* @param mode A file mode. If a string is passed, it is parsed as an octal integer. If not supplied, defaults to `0o666`. | ||
*/ | ||
export function open(path: string | Buffer, flags: string | number, mode: number, callback: (err: NodeJS.ErrnoException, fd: number) => void): void; | ||
export function open( | ||
path: PathLike, | ||
flags: string | number, | ||
mode: string | number | null | undefined, | ||
callback: (err: NodeJS.ErrnoException | null, fd: number) => void | ||
): void; | ||
/** | ||
* Asynchronous `open(2)`. | ||
* | ||
* open and possibly create a file. If the file is created, its mode will be `0o666`. | ||
* | ||
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol. | ||
*/ | ||
export function open(path: string | Buffer, flags: string | number, callback: (err: NodeJS.ErrnoException, fd: number) => void): void; | ||
export function open( | ||
path: PathLike, | ||
flags: string | number, | ||
callback: (err: NodeJS.ErrnoException | null, fd: number) => void | ||
): void; | ||
/** | ||
* Asynchronous `open(2)`. | ||
* | ||
* open and possibly create a file. | ||
* | ||
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol. | ||
* @param mode A file mode. If a string is passed, it is parsed as an octal integer. If not supplied, defaults to `0o666`. | ||
*/ | ||
export function open(path: string | Buffer, flags: string | number, mode?: number): Promise<number>; | ||
export function open(path: PathLike, flags: string | number, mode?: string | number | null): Promise<number>; | ||
/** | ||
* Change the file timestamps of the file referenced by the supplied path. | ||
* | ||
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol. | ||
* @param atime The last access time. If a string is provided, it will be coerced to number. | ||
* @param mtime The last modified time. If a string is provided, it will be coerced to number. | ||
*/ | ||
export function utimes(path: string | Buffer, atime: number | Date, mtime: number | Date, callback: (err?: NodeJS.ErrnoException) => void): void; | ||
export function utimes( | ||
path: PathLike, | ||
atime: string | number | Date, | ||
mtime: string | number | Date, | ||
callback: NoParamCallback | ||
): void; | ||
/** | ||
* Change the file timestamps of the file referenced by the supplied path. | ||
* | ||
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol. | ||
* @param atime The last access time. If a string is provided, it will be coerced to number. | ||
* @param mtime The last modified time. If a string is provided, it will be coerced to number. | ||
*/ | ||
export function utimes(path: string | Buffer, atime: number | Date, mtime: number | Date): Promise<void>; | ||
export function utimes(path: PathLike, atime: string | number | Date, mtime: string | number | Date): Promise<void>; | ||
/** | ||
* Change the file timestamps of a file referenced by the supplied file descriptor. | ||
* | ||
* @param fd A file descriptor. | ||
* @param atime The last access time. If a string is provided, it will be coerced to number. | ||
* @param mtime The last modified time. If a string is provided, it will be coerced to number. | ||
*/ | ||
export function futimes(fd: number, atime: number | Date, mtime: number | Date, callback: (err?: NodeJS.ErrnoException) => void): void; | ||
export function futimes( | ||
fd: number, | ||
atime: string | number | Date, | ||
mtime: string | number | Date, | ||
callback: NoParamCallback | ||
): void; | ||
/** | ||
* Change the file timestamps of a file referenced by the supplied file descriptor. | ||
* | ||
* @param fd A file descriptor. | ||
* @param atime The last access time. If a string is provided, it will be coerced to number. | ||
* @param mtime The last modified time. If a string is provided, it will be coerced to number. | ||
*/ | ||
export function futimes(fd: number, atime: number | Date, mtime: number | Date): Promise<void>; | ||
export function futimes(fd: number, atime: string | number | Date, mtime: string | number | Date): Promise<void>; | ||
/** | ||
* Asynchronous `fsync(2)`. | ||
* | ||
* synchronize a file's in-core state with the underlying storage device. | ||
* | ||
* @param fd A file descriptor. | ||
*/ | ||
export function fsync(fd: number, callback: (err?: NodeJS.ErrnoException) => void): void; | ||
export function fsync(fd: number, callback: NoParamCallback): void; | ||
/** | ||
* Asynchronous `fsync(2)`. | ||
* | ||
* synchronize a file's in-core state with the underlying storage device. | ||
* | ||
* @param fd A file descriptor. | ||
*/ | ||
@@ -389,45 +965,164 @@ export function fsync(fd: number): Promise<void>; | ||
/** | ||
* Write `data` to the file specified by `fd`. | ||
* Write `buffer` to the file specified by `fd`. | ||
* | ||
* @param fd A file descriptor. | ||
* @param offset The part of the buffer to be written. If not supplied, defaults to `0`. | ||
* @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`. | ||
* @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. | ||
*/ | ||
export function write(fd: number, data: any, position: number, encoding: string, callback: (err: NodeJS.ErrnoException, written: number, str: string) => void): void; | ||
export function 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; | ||
/** | ||
* Write `data` to the file specified by `fd`. | ||
* Write `buffer` to the file specified by `fd`. | ||
* | ||
* @param fd A file descriptor. | ||
* @param offset The part of the buffer to be written. If not supplied, defaults to `0`. | ||
* @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`. | ||
*/ | ||
export function write(fd: number, data: any, position: number, callback: (err: NodeJS.ErrnoException, written: number, str: string) => void): void; | ||
export function write<TBuffer extends NodeJS.ArrayBufferView>( | ||
fd: number, | ||
buffer: TBuffer, | ||
offset: number | null | undefined, | ||
length: number | null | undefined, | ||
callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void | ||
): void; | ||
/** | ||
* Write `data` to the file specified by `fd`. | ||
* Write `buffer` to the file specified by `fd`. | ||
* | ||
* @param fd A file descriptor. | ||
* @param offset The part of the buffer to be written. If not supplied, defaults to `0`. | ||
*/ | ||
export function write(fd: number, data: any, callback: (err: NodeJS.ErrnoException, written: number, str: string) => void): void; | ||
export function write<TBuffer extends NodeJS.ArrayBufferView>( | ||
fd: number, | ||
buffer: TBuffer, | ||
offset: number | null | undefined, | ||
callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void | ||
): void; | ||
/** | ||
* Write `data` to the file specified by `fd`. | ||
* Write `buffer` to the file specified by `fd`. | ||
* | ||
* @param fd A file descriptor. | ||
*/ | ||
export function write(fd: number, data: string, position?: number, encoding?: string): Promise<[number, string]>; | ||
export function write<TBuffer extends NodeJS.ArrayBufferView>( | ||
fd: number, | ||
buffer: TBuffer, | ||
callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void | ||
): void; | ||
/** | ||
* Write `buffer` to the file specified by `fd`. | ||
* | ||
* @param fd A file descriptor. | ||
* @param offset The part of the buffer to be written. If not supplied, defaults to `0`. | ||
* @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`. | ||
* @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. | ||
*/ | ||
export function write(fd: number, buffer: Buffer, offset: number, length: number, position: number, callback: (err: NodeJS.ErrnoException, written: number, buffer: Buffer) => void): void; | ||
export function write<TBuffer extends NodeJS.ArrayBufferView>( | ||
fd: number, | ||
buffer?: TBuffer, | ||
offset?: number, | ||
length?: number, | ||
position?: number | null | ||
): Promise<[number, TBuffer]>; | ||
/** | ||
* Write `buffer` to the file specified by `fd`. | ||
* Write `data` to the file specified by `fd`. | ||
* | ||
* @param fd A file descriptor. | ||
* @param string A string to write. If something other than a string is supplied it will be coerced to a string. | ||
* @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. | ||
* @param encoding The expected string encoding. | ||
*/ | ||
export function write(fd: number, buffer: Buffer, offset: number, length: number, callback: (err: NodeJS.ErrnoException, written: number, buffer: Buffer) => void): void; | ||
export function write( | ||
fd: number, | ||
data: any, | ||
position: number | null | undefined, | ||
encoding: string | null | undefined, | ||
callback: (err: NodeJS.ErrnoException | null, written: number, str: string) => void | ||
): void; | ||
/** | ||
* Write `buffer` to the file specified by `fd`. | ||
* Write `data` to the file specified by `fd`. | ||
* | ||
* @param fd A file descriptor. | ||
* @param string A string to write. If something other than a string is supplied it will be coerced to a string. | ||
* @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. | ||
*/ | ||
export function write(fd: number, buffer: Buffer, offset: number, length: number, position?: number): Promise<[number, Buffer]>; | ||
export function write( | ||
fd: number, | ||
data: any, | ||
position: number | null | undefined, | ||
callback: (err: NodeJS.ErrnoException | null, written: number, str: string) => void | ||
): void; | ||
/** | ||
* Write `data` to the file specified by `fd`. | ||
* | ||
* @param fd A file descriptor. | ||
* @param string A string to write. If something other than a string is supplied it will be coerced to a string. | ||
*/ | ||
export function write( | ||
fd: number, | ||
data: any, | ||
callback: (err: NodeJS.ErrnoException | null, written: number, str: string) => void | ||
): void; | ||
/** | ||
* Write `data` to the file specified by `fd`. | ||
* | ||
* @param fd A file descriptor. | ||
* @param string A string to write. If something other than a string is supplied it will be coerced to a string. | ||
* @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. | ||
* @param encoding The expected string encoding. | ||
*/ | ||
export function write( | ||
fd: number, | ||
string: any, | ||
position?: number | null, | ||
encoding?: string | null | ||
): Promise<[number, string]>; | ||
/** | ||
* Read data from the file specified by `fd`. | ||
* | ||
* @param fd A file descriptor. | ||
* @param buffer The buffer that the data will be written to. | ||
* @param offset The offset in the buffer at which to start writing. | ||
* @param length The number of bytes to read. | ||
* @param 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. | ||
*/ | ||
export function read(fd: number, buffer: Buffer, offset: number, length: number, position: number, callback: (err: NodeJS.ErrnoException, bytesRead: number, buffer: Buffer) => void): void; | ||
export function 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; | ||
/** | ||
* Read data from the file specified by `fd`. | ||
* | ||
* @param fd A file descriptor. | ||
* @param buffer The buffer that the data will be written to. | ||
* @param offset The offset in the buffer at which to start writing. | ||
* @param length The number of bytes to read. | ||
* @param 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. | ||
*/ | ||
export function read(fd: number, buffer: Buffer, offset: number, length: number, position: number): Promise<[number, Buffer]>; | ||
export function read<TBuffer extends NodeJS.ArrayBufferView>( | ||
fd: number, | ||
buffer: TBuffer, | ||
offset: number, | ||
length: number, | ||
position: number | null | ||
): Promise<{ bytesRead: number; buffer: TBuffer }>; | ||
@@ -437,6 +1132,12 @@ /** | ||
* | ||
* @param file The filename or descriptor | ||
* @param options The encoding for the result, or an object containing options. | ||
* @param 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. | ||
* @param options An object that may contain an optional flag. | ||
* If a flag is not provided, it defaults to `'r'`. | ||
*/ | ||
export function readFile(file: string | number | Buffer, options: { encoding?: "buffer" | null; flag?: string; } | "buffer" | undefined | null, callback: (err: NodeJS.ErrnoException, data: Buffer) => void): void; | ||
export function readFile( | ||
path: PathLike | number, | ||
options: { encoding?: null; flag?: string } | null | undefined, | ||
callback: (err: NodeJS.ErrnoException | null, data: Buffer) => void | ||
): void; | ||
@@ -446,6 +1147,13 @@ /** | ||
* | ||
* @param file The filename or descriptor | ||
* @param options The encoding for the result, or an object containing options. | ||
* @param 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. | ||
* @param 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'`. | ||
*/ | ||
export function readFile(file: string | number | Buffer, options: { encoding: string; flag?: string; } | string, callback: (err: NodeJS.ErrnoException, data: string) => void): void; | ||
export function readFile( | ||
path: PathLike | number, | ||
options: { encoding: string; flag?: string } | string, | ||
callback: (err: NodeJS.ErrnoException | null, data: string) => void | ||
): void; | ||
@@ -455,5 +1163,13 @@ /** | ||
* | ||
* @param file The filename or descriptor | ||
* @param 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. | ||
* @param 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'`. | ||
*/ | ||
export function readFile(file: string | number | Buffer, callback: (err: NodeJS.ErrnoException, data: Buffer) => void): void; | ||
export function readFile( | ||
path: PathLike | number, | ||
options: { encoding?: string | null; flag?: string } | string | null | undefined, | ||
callback: (err: NodeJS.ErrnoException | null, data: string | Buffer) => void | ||
): void; | ||
@@ -463,6 +1179,9 @@ /** | ||
* | ||
* @param file The filename or descriptor | ||
* @param options The encoding for the result, or an object containing options. | ||
* @param 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. | ||
*/ | ||
export function readFile(file: string | number | Buffer, options?: { encoding?: "buffer" | null; flag?: string; } | "buffer" | null): Promise<Buffer>; | ||
export function readFile( | ||
path: PathLike | number, | ||
callback: (err: NodeJS.ErrnoException | null, data: Buffer) => void | ||
): void; | ||
@@ -472,21 +1191,81 @@ /** | ||
* | ||
* @param file The filename or descriptor | ||
* @param options The encoding for the result, or an object containing options. | ||
* @param 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. | ||
* @param options An object that may contain an optional flag. | ||
* If a flag is not provided, it defaults to `'r'`. | ||
*/ | ||
export function readFile(file: string | number | Buffer, options: { encoding: string; flag?: string; } | string): Promise<string>; | ||
export function readFile(path: PathLike | number, options?: { encoding?: null; flag?: string } | null): Promise<Buffer>; | ||
/** | ||
* Asynchronously reads the entire contents of a file. | ||
* | ||
* @param 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. | ||
* @param 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'`. | ||
*/ | ||
export function readFile( | ||
path: PathLike | number, | ||
options: { encoding: string; flag?: string } | string | ||
): Promise<string>; | ||
/** | ||
* Asynchronously reads the entire contents of a file. | ||
* | ||
* @param 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. | ||
* @param 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'`. | ||
*/ | ||
export function readFile( | ||
path: PathLike | number, | ||
options?: { encoding?: string | null; flag?: string } | string | null | ||
): Promise<string | Buffer>; | ||
/** | ||
* Asynchronously writes data to a file, replacing the file if it already exists. | ||
* | ||
* @param 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. | ||
* @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string. | ||
* @param 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. | ||
* 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. | ||
*/ | ||
export function writeFile(filename: string | number | Buffer, data: string | Buffer, options: { encoding?: string | null; mode?: string | number; flag?: string; } | string | undefined | null, callback: (err: NodeJS.ErrnoException) => void): void; | ||
export function writeFile( | ||
path: PathLike | number, | ||
data: any, | ||
options: WriteFileOptions, | ||
callback: NoParamCallback | ||
): void; | ||
/** | ||
* Asynchronously writes data to a file, replacing the file if it already exists. | ||
* | ||
* @param 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. | ||
* @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string. | ||
*/ | ||
export function writeFile(filename: string | number | Buffer, data: string | Buffer, callback: (err: NodeJS.ErrnoException) => void): void; | ||
export function writeFile(path: PathLike | number, data: any, callback: NoParamCallback): void; | ||
/** | ||
* Asynchronously writes data to a file, replacing the file if it already exists. | ||
* | ||
* @param 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. | ||
* @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string. | ||
* @param 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. | ||
* 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. | ||
*/ | ||
export function writeFile(file: string | number | Buffer, data: string | Buffer, options?: { encoding?: string | null; mode?: string | number; flag?: string; } | string | null): Promise<void>; | ||
export function writeFile(path: PathLike | number, data: any, options?: WriteFileOptions): Promise<void>; | ||
@@ -496,7 +1275,18 @@ /** | ||
* | ||
* @param file The path to the file or a file descriptor. | ||
* @param data The data to append to the file. | ||
* @param options The encoding for `data`, or an object with additional options. | ||
* @param 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. | ||
* @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string. | ||
* @param 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. | ||
* 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. | ||
*/ | ||
export function appendFile(file: string | number | Buffer, data: string | Buffer, options: { encoding?: string | null; mode?: string | number; flag?: string; } | string | undefined | null, callback: (err: NodeJS.ErrnoException) => void): void; | ||
export function appendFile( | ||
file: PathLike | number, | ||
data: any, | ||
options: WriteFileOptions, | ||
callback: NoParamCallback | ||
): void; | ||
@@ -506,6 +1296,8 @@ /** | ||
* | ||
* @param file The path to the file or a file descriptor. | ||
* @param data The data to append to the file. | ||
* @param 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. | ||
* @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string. | ||
*/ | ||
export function appendFile(file: string | number | Buffer, data: string | Buffer, callback: (err: NodeJS.ErrnoException) => void): void; | ||
export function appendFile(file: PathLike | number, data: any, callback: NoParamCallback): void; | ||
@@ -515,14 +1307,101 @@ /** | ||
* | ||
* @param file The path to the file or a file descriptor. | ||
* @param data The data to append to the file. | ||
* @param options The encoding for `data`, or an object with additional options. | ||
* @param 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. | ||
* @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string. | ||
* @param 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. | ||
* 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. | ||
*/ | ||
export function appendFile(file: string | number | Buffer, data: string | Buffer, options?: { encoding?: string | null; mode?: number | string; flag?: string; } | string | null): Promise<void>; | ||
export function appendFile(file: PathLike | number, data: any, options?: WriteFileOptions): Promise<void>; | ||
/** | ||
* Watch for changes on `filename`. The callback `listener` will be called each time the file is accessed. | ||
*/ | ||
export function watchFile( | ||
filename: PathLike, | ||
options: { persistent?: boolean; interval?: number } | undefined, | ||
listener: (curr: Stats, prev: Stats) => void | ||
): void; | ||
/** | ||
* Watch for changes on `filename`. The callback `listener` will be called each time the file is accessed. | ||
* @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol. | ||
* URL support is _experimental_. | ||
*/ | ||
export function watchFile(filename: PathLike, listener: (curr: Stats, prev: Stats) => void): void; | ||
/** | ||
* Stop watching for changes on `filename`. | ||
* @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol. | ||
* URL support is _experimental_. | ||
*/ | ||
export function unwatchFile(filename: PathLike, listener?: (curr: Stats, prev: Stats) => void): void; | ||
/** | ||
* Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`. | ||
* @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol. | ||
* URL support is _experimental_. | ||
* @param options Either the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options. | ||
* If `encoding` is not supplied, the default of `'utf8'` is used. | ||
* If `persistent` is not supplied, the default of `true` is used. | ||
* If `recursive` is not supplied, the default of `false` is used. | ||
*/ | ||
export function watch( | ||
filename: PathLike, | ||
options: | ||
{ encoding?: BufferEncoding | null; persistent?: boolean; recursive?: boolean } | | ||
BufferEncoding | | ||
undefined | | ||
null, | ||
listener?: (event: string, filename: string) => void | ||
): FSWatcher; | ||
/** | ||
* Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`. | ||
* @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol. | ||
* URL support is _experimental_. | ||
* @param options Either the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options. | ||
* If `encoding` is not supplied, the default of `'utf8'` is used. | ||
* If `persistent` is not supplied, the default of `true` is used. | ||
* If `recursive` is not supplied, the default of `false` is used. | ||
*/ | ||
export function watch( | ||
filename: PathLike, | ||
options: { encoding: "buffer"; persistent?: boolean; recursive?: boolean } | "buffer", | ||
listener?: (event: string, filename: Buffer) => void | ||
): FSWatcher; | ||
/** | ||
* Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`. | ||
* @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol. | ||
* URL support is _experimental_. | ||
* @param options Either the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options. | ||
* If `encoding` is not supplied, the default of `'utf8'` is used. | ||
* If `persistent` is not supplied, the default of `true` is used. | ||
* If `recursive` is not supplied, the default of `false` is used. | ||
*/ | ||
export function watch( | ||
filename: PathLike, | ||
options: { encoding?: string | null; persistent?: boolean; recursive?: boolean } | string | null, | ||
listener?: (event: string, filename: string | Buffer) => void | ||
): FSWatcher; | ||
/** | ||
* Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`. | ||
* @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol. | ||
* URL support is _experimental_. | ||
*/ | ||
export function watch(filename: PathLike, listener?: (event: string, filename: string) => any): FSWatcher; | ||
/** | ||
* Test whether or not the given path exists by checking with the file system. | ||
* | ||
* @param path The path to access. | ||
* @deprecated | ||
* @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol. | ||
* URL support is _experimental_. | ||
*/ | ||
export function exists(path: string | Buffer, callback: (err: NodeJS.ErrnoException, exists: boolean) => void): void; | ||
export function exists(path: PathLike, callback: (err: NodeJS.ErrnoException | null, exists: boolean) => void): void; | ||
@@ -532,5 +1411,6 @@ /** | ||
* | ||
* @param path The path to access. | ||
* @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol. | ||
* URL support is _experimental_. | ||
*/ | ||
export function exists(path: string): Promise<boolean>; | ||
export function exists(path: PathLike): Promise<boolean>; | ||
@@ -540,6 +1420,7 @@ /** | ||
* | ||
* @param path The path to access. | ||
* @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol. | ||
* URL support is _experimental_. | ||
* @param mode An optional integer that specifies the accessibility checks to be performed. | ||
*/ | ||
export function access(path: string | Buffer, mode: number, callback: (err: NodeJS.ErrnoException) => void): void; | ||
export function access(path: PathLike, mode: number | undefined, callback: NoParamCallback): void; | ||
@@ -549,5 +1430,6 @@ /** | ||
* | ||
* @param path The path to access. | ||
* @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol. | ||
* URL support is _experimental_. | ||
*/ | ||
export function access(path: string | Buffer, callback: (err: NodeJS.ErrnoException) => void): void; | ||
export function access(path: PathLike, callback: NoParamCallback): void; | ||
@@ -557,5 +1439,97 @@ /** | ||
* | ||
* @param path The path to access. | ||
* @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol. | ||
* URL support is _experimental_. | ||
* @param mode An optional integer that specifies the accessibility checks to be performed. | ||
*/ | ||
export function access(path: string, mode?: number): Promise<void>; | ||
export function access(path: PathLike, mode?: number): Promise<void>; | ||
/** | ||
* Asynchronous `fdatasync(2)`. | ||
* | ||
* Synchronize a file's in-core state with storage device. | ||
* | ||
* @param fd A file descriptor. | ||
*/ | ||
export function fdatasync(fd: number, callback: NoParamCallback): void; | ||
/** | ||
* Asynchronous `fdatasync(2)`. | ||
* | ||
* Synchronize a file's in-core state with storage device. | ||
* | ||
* @param fd A file descriptor. | ||
*/ | ||
export function fdatasync(fd: 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. | ||
* | ||
* @param src A path to the source file. | ||
* @param dest A path to the destination file. | ||
*/ | ||
export function copyFile(src: PathLike, dest: PathLike, callback: NoParamCallback): 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. | ||
* | ||
* @param src A path to the source file. | ||
* @param dest A path to the destination file. | ||
* @param flags An integer that specifies the behavior of the copy operation. The only supported flag is fs.constants.COPYFILE_EXCL, which causes the copy operation to fail if dest already exists. | ||
*/ | ||
export function copyFile(src: PathLike, dest: PathLike, flags: number, callback: NoParamCallback): 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. | ||
* | ||
* @param src A path to the source file. | ||
* @param dest A path to the destination file. | ||
* @param 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. | ||
*/ | ||
export function copyFile(src: PathLike, dest: PathLike, flags?: number): Promise<void>; | ||
/** | ||
* 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. | ||
*/ | ||
export function writev( | ||
fd: number, | ||
buffers: NodeJS.ArrayBufferView[], | ||
cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers: NodeJS.ArrayBufferView[]) => void | ||
): void; | ||
export function writev( | ||
fd: number, | ||
buffers: NodeJS.ArrayBufferView[], | ||
position: number, | ||
cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers: NodeJS.ArrayBufferView[]) => void | ||
): void; | ||
export function writev( | ||
fd: number, | ||
buffers: NodeJS.ArrayBufferView[], | ||
position?: number | ||
): Promise<[number, NodeJS.ArrayBufferView[]]>; |
@@ -1,16 +0,18 @@ | ||
// Type definitions for mz | ||
// Type definitions for mz 2.7 | ||
// Project: https://github.com/normalize/mz | ||
// Definitions by: Thomas Hickman <https://github.com/ThomasHickman> | ||
// ExE Boss <https://github.com/ExE-Boss> | ||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | ||
// Modified from the node.js definitions https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/node/node.d.ts | ||
// Modified from the node.js definitions. | ||
// https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/node/index.d.ts | ||
/// <reference types="node" /> | ||
/// <reference types="node"/> | ||
import * as child_process from "mz/child_process"; | ||
import * as crypto from "mz/crypto"; | ||
import * as dns from "mz/dns"; | ||
import * as fs from "mz/fs"; | ||
import * as readline from "mz/readline"; | ||
import * as zlib from "mz/zlib"; | ||
export { child_process, crypto, dns, fs, readline, zlib }; | ||
import * as child_process from "./child_process"; | ||
import * as crypto from "./crypto"; | ||
import * as dns from "./dns"; | ||
import * as fs from "./fs"; | ||
import * as readline from "./readline"; | ||
import * as zlib from "./zlib"; | ||
export { child_process, crypto, dns, fs, readline, zlib }; |
{ | ||
"name": "@types/mz", | ||
"version": "0.0.32", | ||
"version": "2.7.0", | ||
"description": "TypeScript definitions for mz", | ||
@@ -11,8 +11,15 @@ "license": "MIT", | ||
"githubUsername": "ThomasHickman" | ||
}, | ||
{ | ||
"name": "ExE Boss", | ||
"url": "https://github.com/ExE-Boss", | ||
"githubUsername": "ExE-Boss" | ||
} | ||
], | ||
"main": "", | ||
"types": "index.d.ts", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://www.github.com/DefinitelyTyped/DefinitelyTyped.git" | ||
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", | ||
"directory": "types/mz" | ||
}, | ||
@@ -23,4 +30,4 @@ "scripts": {}, | ||
}, | ||
"typesPublisherContentHash": "571a2bbaaa62345b7ace643a79806a695c856343b354f874adc6d3e52544aebe", | ||
"typeScriptVersion": "2.0" | ||
"typesPublisherContentHash": "75c87edb73b6b34ea8a800922c69734d423e22f977a78779d7340fe17829e102", | ||
"typeScriptVersion": "2.8" | ||
} |
@@ -1,32 +0,31 @@ | ||
// Type definitions for mz | ||
// Project: https://github.com/normalize/mz | ||
// Definitions by: Thomas Hickman <https://github.com/ThomasHickman> | ||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | ||
// Modified from the node.js definitions. | ||
// https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/node/readline.d.ts | ||
// Modified from the node.js definitions https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/node/node.d.ts | ||
/// <reference types="node" /> | ||
import * as readline from "readline"; | ||
export * from "readline"; | ||
export { Completer as SyncCompleter } from "readline"; | ||
export interface ReadLine extends readline.ReadLine { | ||
question(query: string, callback: (answer: string) => void): void; | ||
question(query: string): Promise<string>; | ||
export class Interface extends readline.Interface { | ||
question(query: string, callback: (answer: string) => void): void; | ||
question(query: string): Promise<string>; | ||
} | ||
export interface Completer { | ||
(line: string, callback: (err: any, result: [string[], string]) => void): void; | ||
(line: string): Promise<[string[], string]> | [string[], string]; | ||
} | ||
// type forwarded for backwards compatibility | ||
export type ReadLine = Interface; | ||
export interface ReadLineOptions { | ||
input: NodeJS.ReadableStream; | ||
output?: NodeJS.WritableStream; | ||
completer?: Completer; | ||
terminal?: boolean; | ||
historySize?: number; | ||
export type AsyncCompleter = | ||
((line: string, callback: (err?: null | Error, result?: readline.CompleterResult) => void) => void) | | ||
((line: string) => Promise<readline.CompleterResult>); | ||
export type Completer = AsyncCompleter | readline.Completer; | ||
export interface ReadLineOptions extends readline.ReadLineOptions { | ||
completer?: Completer; | ||
} | ||
export function createInterface(input: NodeJS.ReadableStream, output?: NodeJS.WritableStream, completer?: Completer, terminal?: boolean): ReadLine; | ||
export function createInterface(options: ReadLineOptions): ReadLine; | ||
export function createInterface( | ||
input: NodeJS.ReadableStream, | ||
output?: NodeJS.WritableStream, | ||
completer?: Completer, | ||
terminal?: boolean | ||
): Interface; | ||
export function createInterface(options: ReadLineOptions): Interface; |
@@ -8,10 +8,10 @@ # Installation | ||
# Details | ||
Files were exported from https://www.github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/mz | ||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/mz. | ||
Additional Details | ||
* Last updated: Tue, 26 Sep 2017 23:00:43 GMT | ||
* Dependencies: child_process, node, dns, readline, crypto, zlib, fs | ||
### Additional Details | ||
* Last updated: Fri, 22 Nov 2019 17:05:29 GMT | ||
* Dependencies: [@types/node](https://npmjs.com/package/@types/node) | ||
* Global values: none | ||
# Credits | ||
These definitions were written by Thomas Hickman <https://github.com/ThomasHickman>. | ||
These definitions were written by Thomas Hickman (https://github.com/ThomasHickman), and ExE Boss (https://github.com/ExE-Boss). |
107
mz/zlib.d.ts
@@ -1,32 +0,95 @@ | ||
// Type definitions for mz | ||
// Project: https://github.com/normalize/mz | ||
// Definitions by: Thomas Hickman <https://github.com/ThomasHickman> | ||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | ||
// Modified from the node.js definitions. | ||
// https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/node/zlib.d.ts | ||
// Modified from the node.js definitions https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/node/node.d.ts | ||
import { InputType, CompressCallback, BrotliOptions, ZlibOptions } from "zlib"; | ||
export * from "zlib"; | ||
/// <reference types="node" /> | ||
/** | ||
* Compress the buffer using the **Brotli Compression** algorithm. | ||
* | ||
* @param buf The buffer. | ||
* @param options The compression options. | ||
*/ | ||
export function brotliCompress(buf: InputType, callback: CompressCallback): void; | ||
export function brotliCompress(buf: InputType, options: BrotliOptions, callback: CompressCallback): void; | ||
export function brotliCompress(buf: InputType, options?: BrotliOptions): Promise<Buffer>; | ||
import * as zlib from "zlib"; | ||
export * from "zlib"; | ||
/** | ||
* Decompress the buffer using the **Brotli Compression** algorithm. | ||
* | ||
* @param buf The buffer. | ||
* @param options The compression options. | ||
*/ | ||
export function brotliDecompress(buf: InputType, callback: CompressCallback): void; | ||
export function brotliDecompress(buf: InputType, options: BrotliOptions, callback: CompressCallback): void; | ||
export function brotliDecompress(buf: InputType, options?: BrotliOptions): Promise<Buffer>; | ||
export function deflate(buf: Buffer, callback: (error: Error, result: Buffer) => void): void; | ||
export function deflate(buf: Buffer): Promise<Buffer>; | ||
/** | ||
* Compress the buffer using the **DEFLATE** algorithm. | ||
* | ||
* @param buf The buffer. | ||
* @param options The compression options. | ||
*/ | ||
export function deflate(buf: InputType, callback: CompressCallback): void; | ||
export function deflate(buf: InputType, options: ZlibOptions, callback: CompressCallback): void; | ||
export function deflate(buf: InputType, options?: ZlibOptions): Promise<Buffer>; | ||
export function deflateRaw(buf: Buffer, callback: (error: Error, result: Buffer) => void): void; | ||
export function deflateRaw(buf: Buffer): Promise<Buffer>; | ||
/** | ||
* Compress the buffer using the **DEFLATE** algorithm. | ||
* | ||
* @param buf The buffer. | ||
* @param options The compression options. | ||
*/ | ||
export function deflateRaw(buf: InputType, callback: CompressCallback): void; | ||
export function deflateRaw(buf: InputType, options: ZlibOptions, callback: CompressCallback): void; | ||
export function deflateRaw(buf: InputType, options?: ZlibOptions): Promise<Buffer>; | ||
export function gzip(buf: Buffer, callback: (error: Error, result: Buffer) => void): void; | ||
export function gzip(buf: Buffer): Promise<Buffer>; | ||
/** | ||
* Compress the buffer using the **GZIP** algorithm. | ||
* | ||
* @param buf The buffer. | ||
* @param options The compression options. | ||
*/ | ||
export function gzip(buf: InputType, callback: CompressCallback): void; | ||
export function gzip(buf: InputType, options: ZlibOptions, callback: CompressCallback): void; | ||
export function gzip(buf: InputType, options?: ZlibOptions): Promise<Buffer>; | ||
export function gunzip(buf: Buffer, callback: (error: Error, result: Buffer) => void): void; | ||
export function gunzip(buf: Buffer): Promise<Buffer>; | ||
/** | ||
* Decompress the buffer using the **GZIP** algorithm. | ||
* | ||
* @param buf The buffer. | ||
* @param options The compression options. | ||
*/ | ||
export function gunzip(buf: InputType, callback: CompressCallback): void; | ||
export function gunzip(buf: InputType, options: ZlibOptions, callback: CompressCallback): void; | ||
export function gunzip(buf: InputType, options?: ZlibOptions): Promise<Buffer>; | ||
export function inflate(buf: Buffer, callback: (error: Error, result: Buffer) => void): void; | ||
export function inflate(buf: Buffer): Promise<Buffer>; | ||
/** | ||
* Decompress the buffer using the **DEFLATE** algorithm. | ||
* | ||
* @param buf The buffer. | ||
* @param options The compression options. | ||
*/ | ||
export function inflate(buf: InputType, callback: CompressCallback): void; | ||
export function inflate(buf: InputType, options: ZlibOptions, callback: CompressCallback): void; | ||
export function inflate(buf: InputType, options?: ZlibOptions): Promise<Buffer>; | ||
export function inflateRaw(buf: Buffer, callback: (error: Error, result: Buffer) => void): void; | ||
export function inflateRaw(buf: Buffer): Promise<Buffer>; | ||
/** | ||
* Decompress the buffer using the **DEFLATE** algorithm. | ||
* | ||
* @param buf The buffer. | ||
* @param options The compression options. | ||
*/ | ||
export function inflateRaw(buf: InputType, callback: CompressCallback): void; | ||
export function inflateRaw(buf: InputType, options: ZlibOptions, callback: CompressCallback): void; | ||
export function inflateRaw(buf: InputType, options?: ZlibOptions): Promise<Buffer>; | ||
export function unzip(buf: Buffer, callback: (error: Error, result: Buffer) => void): void; | ||
export function unzip(buf: Buffer): Promise<Buffer>; | ||
/** | ||
* Decompress the buffer using the **ZIP** algorithm. | ||
* | ||
* @param buf The buffer. | ||
* @param options The compression options. | ||
*/ | ||
export function unzip(buf: InputType, callback: CompressCallback): void; | ||
export function unzip(buf: InputType, options: ZlibOptions, callback: CompressCallback): void; | ||
export function unzip(buf: InputType, options?: ZlibOptions): Promise<Buffer>; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
76989
1838
1
1