@types/node 14.18.9 → 15.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {node v14.18 → node}/LICENSE +0 -0
- node v14.18/README.md → node/README.md +4 -4
- node/assert/strict.d.ts +4 -0
- node v14.18/assert.d.ts → node/assert.d.ts +3 -7
- node v14.18/async_hooks.d.ts → node/async_hooks.d.ts +2 -5
- node/base.d.ts +19 -0
- node/buffer.d.ts +22 -0
- node v14.18/child_process.d.ts → node/child_process.d.ts +63 -67
- node v14.18/cluster.d.ts → node/cluster.d.ts +10 -13
- node v14.18/console.d.ts → node/console.d.ts +13 -22
- node v14.18/constants.d.ts → node/constants.d.ts +0 -5
- node v14.18/crypto.d.ts → node/crypto.d.ts +134 -53
- node v14.18/dgram.d.ts → node/dgram.d.ts +17 -20
- node/dns/promises.d.ts +97 -0
- node/dns.d.ts +322 -0
- node v14.18/domain.d.ts → node/domain.d.ts +0 -3
- node v14.18/events.d.ts → node/events.d.ts +8 -8
- node v14.18/fs/promises.d.ts → node/fs/promises.d.ts +18 -29
- node v14.18/fs.d.ts → node/fs.d.ts +77 -93
- node v14.18/globals.d.ts → node/globals.d.ts +60 -67
- {node v14.18 → node}/globals.global.d.ts +0 -0
- node v14.18/http.d.ts → node/http.d.ts +108 -176
- node v14.18/http2.d.ts → node/http2.d.ts +74 -71
- node/https.d.ts +36 -0
- node v14.18/index.d.ts → node/index.d.ts +15 -55
- node v14.18/inspector.d.ts → node/inspector.d.ts +151 -161
- node v14.18/module.d.ts → node/module.d.ts +0 -4
- node v14.18/net.d.ts → node/net.d.ts +68 -38
- node v14.18/os.d.ts → node/os.d.ts +0 -3
- node v14.18/package.json → node/package.json +25 -19
- node v14.18/path.d.ts → node/path.d.ts +5 -9
- node v14.18/perf_hooks.d.ts → node/perf_hooks.d.ts +5 -8
- node v14.18/process.d.ts → node/process.d.ts +53 -17
- node v14.18/punycode.d.ts → node/punycode.d.ts +0 -3
- node v14.18/querystring.d.ts → node/querystring.d.ts +3 -6
- node v14.18/readline.d.ts → node/readline.d.ts +14 -18
- node v14.18/repl.d.ts → node/repl.d.ts +14 -17
- node/stream/promises.d.ts +67 -0
- node v14.18/stream.d.ts → node/stream.d.ts +164 -60
- node v14.18/string_decoder.d.ts → node/string_decoder.d.ts +0 -3
- node/timers/promises.d.ts +13 -0
- node v14.18/timers.d.ts → node/timers.d.ts +16 -5
- node v14.18/tls.d.ts → node/tls.d.ts +51 -56
- node v14.18/trace_events.d.ts → node/trace_events.d.ts +0 -3
- node/ts3.6/assert.d.ts +98 -0
- node/ts3.6/base.d.ts +66 -0
- node/ts3.6/index.d.ts +7 -0
- node v14.18/tty.d.ts → node/tty.d.ts +0 -3
- node v14.18/url.d.ts → node/url.d.ts +16 -19
- node v14.18/util.d.ts → node/util.d.ts +3 -12
- node v14.18/v8.d.ts → node/v8.d.ts +0 -3
- node v14.18/vm.d.ts → node/vm.d.ts +24 -27
- node v14.18/wasi.d.ts → node/wasi.d.ts +7 -10
- node v14.18/worker_threads.d.ts → node/worker_threads.d.ts +18 -18
- node v14.18/zlib.d.ts → node/zlib.d.ts +16 -19
- node v14.18/buffer.d.ts +0 -89
- node v14.18/dns.d.ts +0 -387
- node v14.18/https.d.ts +0 -142
node/dns.d.ts
ADDED
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
declare module 'dns' {
|
|
2
|
+
import * as dnsPromises from "dns/promises";
|
|
3
|
+
|
|
4
|
+
// Supported getaddrinfo flags.
|
|
5
|
+
export const ADDRCONFIG: number;
|
|
6
|
+
export const V4MAPPED: number;
|
|
7
|
+
/**
|
|
8
|
+
* If `dns.V4MAPPED` is specified, return resolved IPv6 addresses as
|
|
9
|
+
* well as IPv4 mapped IPv6 addresses.
|
|
10
|
+
*/
|
|
11
|
+
export const ALL: number;
|
|
12
|
+
|
|
13
|
+
export interface LookupOptions {
|
|
14
|
+
family?: number;
|
|
15
|
+
hints?: number;
|
|
16
|
+
all?: boolean;
|
|
17
|
+
verbatim?: boolean;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface LookupOneOptions extends LookupOptions {
|
|
21
|
+
all?: false;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface LookupAllOptions extends LookupOptions {
|
|
25
|
+
all: true;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface LookupAddress {
|
|
29
|
+
address: string;
|
|
30
|
+
family: number;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function lookup(hostname: string, family: number, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void): void;
|
|
34
|
+
export function lookup(hostname: string, options: LookupOneOptions, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void): void;
|
|
35
|
+
export function lookup(hostname: string, options: LookupAllOptions, callback: (err: NodeJS.ErrnoException | null, addresses: LookupAddress[]) => void): void;
|
|
36
|
+
export function lookup(hostname: string, options: LookupOptions, callback: (err: NodeJS.ErrnoException | null, address: string | LookupAddress[], family: number) => void): void;
|
|
37
|
+
export function lookup(hostname: string, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void): void;
|
|
38
|
+
|
|
39
|
+
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
|
|
40
|
+
export namespace lookup {
|
|
41
|
+
function __promisify__(hostname: string, options: LookupAllOptions): Promise<LookupAddress[]>;
|
|
42
|
+
function __promisify__(hostname: string, options?: LookupOneOptions | number): Promise<LookupAddress>;
|
|
43
|
+
function __promisify__(hostname: string, options: LookupOptions): Promise<LookupAddress | LookupAddress[]>;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function lookupService(address: string, port: number, callback: (err: NodeJS.ErrnoException | null, hostname: string, service: string) => void): void;
|
|
47
|
+
|
|
48
|
+
export namespace lookupService {
|
|
49
|
+
function __promisify__(address: string, port: number): Promise<{ hostname: string, service: string }>;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface ResolveOptions {
|
|
53
|
+
ttl: boolean;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export interface ResolveWithTtlOptions extends ResolveOptions {
|
|
57
|
+
ttl: true;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface RecordWithTtl {
|
|
61
|
+
address: string;
|
|
62
|
+
ttl: number;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/** @deprecated Use `AnyARecord` or `AnyAaaaRecord` instead. */
|
|
66
|
+
export type AnyRecordWithTtl = AnyARecord | AnyAaaaRecord;
|
|
67
|
+
|
|
68
|
+
export interface AnyARecord extends RecordWithTtl {
|
|
69
|
+
type: "A";
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export interface AnyAaaaRecord extends RecordWithTtl {
|
|
73
|
+
type: "AAAA";
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export interface CaaRecord {
|
|
77
|
+
critial: number;
|
|
78
|
+
issue?: string;
|
|
79
|
+
issuewild?: string;
|
|
80
|
+
iodef?: string;
|
|
81
|
+
contactemail?: string;
|
|
82
|
+
contactphone?: string;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export interface MxRecord {
|
|
86
|
+
priority: number;
|
|
87
|
+
exchange: string;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export interface AnyMxRecord extends MxRecord {
|
|
91
|
+
type: "MX";
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export interface NaptrRecord {
|
|
95
|
+
flags: string;
|
|
96
|
+
service: string;
|
|
97
|
+
regexp: string;
|
|
98
|
+
replacement: string;
|
|
99
|
+
order: number;
|
|
100
|
+
preference: number;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export interface AnyNaptrRecord extends NaptrRecord {
|
|
104
|
+
type: "NAPTR";
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export interface SoaRecord {
|
|
108
|
+
nsname: string;
|
|
109
|
+
hostmaster: string;
|
|
110
|
+
serial: number;
|
|
111
|
+
refresh: number;
|
|
112
|
+
retry: number;
|
|
113
|
+
expire: number;
|
|
114
|
+
minttl: number;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export interface AnySoaRecord extends SoaRecord {
|
|
118
|
+
type: "SOA";
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export interface SrvRecord {
|
|
122
|
+
priority: number;
|
|
123
|
+
weight: number;
|
|
124
|
+
port: number;
|
|
125
|
+
name: string;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export interface AnySrvRecord extends SrvRecord {
|
|
129
|
+
type: "SRV";
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export interface AnyTxtRecord {
|
|
133
|
+
type: "TXT";
|
|
134
|
+
entries: string[];
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export interface AnyNsRecord {
|
|
138
|
+
type: "NS";
|
|
139
|
+
value: string;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export interface AnyPtrRecord {
|
|
143
|
+
type: "PTR";
|
|
144
|
+
value: string;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export interface AnyCnameRecord {
|
|
148
|
+
type: "CNAME";
|
|
149
|
+
value: string;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export type AnyRecord = AnyARecord |
|
|
153
|
+
AnyAaaaRecord |
|
|
154
|
+
AnyCnameRecord |
|
|
155
|
+
AnyMxRecord |
|
|
156
|
+
AnyNaptrRecord |
|
|
157
|
+
AnyNsRecord |
|
|
158
|
+
AnyPtrRecord |
|
|
159
|
+
AnySoaRecord |
|
|
160
|
+
AnySrvRecord |
|
|
161
|
+
AnyTxtRecord;
|
|
162
|
+
|
|
163
|
+
export function resolve(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
|
|
164
|
+
export function resolve(hostname: string, rrtype: "A", callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
|
|
165
|
+
export function resolve(hostname: string, rrtype: "AAAA", callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
|
|
166
|
+
export function resolve(hostname: string, rrtype: "ANY", callback: (err: NodeJS.ErrnoException | null, addresses: AnyRecord[]) => void): void;
|
|
167
|
+
export function resolve(hostname: string, rrtype: "CNAME", callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
|
|
168
|
+
export function resolve(hostname: string, rrtype: "MX", callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void): void;
|
|
169
|
+
export function resolve(hostname: string, rrtype: "NAPTR", callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void): void;
|
|
170
|
+
export function resolve(hostname: string, rrtype: "NS", callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
|
|
171
|
+
export function resolve(hostname: string, rrtype: "PTR", callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
|
|
172
|
+
export function resolve(hostname: string, rrtype: "SOA", callback: (err: NodeJS.ErrnoException | null, addresses: SoaRecord) => void): void;
|
|
173
|
+
export function resolve(hostname: string, rrtype: "SRV", callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void): void;
|
|
174
|
+
export function resolve(hostname: string, rrtype: "TXT", callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void): void;
|
|
175
|
+
export function resolve(
|
|
176
|
+
hostname: string,
|
|
177
|
+
rrtype: string,
|
|
178
|
+
callback: (err: NodeJS.ErrnoException | null, addresses: string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[]) => void,
|
|
179
|
+
): void;
|
|
180
|
+
|
|
181
|
+
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
|
|
182
|
+
export namespace resolve {
|
|
183
|
+
function __promisify__(hostname: string, rrtype?: "A" | "AAAA" | "CNAME" | "NS" | "PTR"): Promise<string[]>;
|
|
184
|
+
function __promisify__(hostname: string, rrtype: "ANY"): Promise<AnyRecord[]>;
|
|
185
|
+
function __promisify__(hostname: string, rrtype: "MX"): Promise<MxRecord[]>;
|
|
186
|
+
function __promisify__(hostname: string, rrtype: "NAPTR"): Promise<NaptrRecord[]>;
|
|
187
|
+
function __promisify__(hostname: string, rrtype: "SOA"): Promise<SoaRecord>;
|
|
188
|
+
function __promisify__(hostname: string, rrtype: "SRV"): Promise<SrvRecord[]>;
|
|
189
|
+
function __promisify__(hostname: string, rrtype: "TXT"): Promise<string[][]>;
|
|
190
|
+
function __promisify__(hostname: string, rrtype: string): Promise<string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[]>;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
export function resolve4(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
|
|
194
|
+
export function resolve4(hostname: string, options: ResolveWithTtlOptions, callback: (err: NodeJS.ErrnoException | null, addresses: RecordWithTtl[]) => void): void;
|
|
195
|
+
export function resolve4(hostname: string, options: ResolveOptions, callback: (err: NodeJS.ErrnoException | null, addresses: string[] | RecordWithTtl[]) => void): void;
|
|
196
|
+
|
|
197
|
+
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
|
|
198
|
+
export namespace resolve4 {
|
|
199
|
+
function __promisify__(hostname: string): Promise<string[]>;
|
|
200
|
+
function __promisify__(hostname: string, options: ResolveWithTtlOptions): Promise<RecordWithTtl[]>;
|
|
201
|
+
function __promisify__(hostname: string, options?: ResolveOptions): Promise<string[] | RecordWithTtl[]>;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
export function resolve6(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
|
|
205
|
+
export function resolve6(hostname: string, options: ResolveWithTtlOptions, callback: (err: NodeJS.ErrnoException | null, addresses: RecordWithTtl[]) => void): void;
|
|
206
|
+
export function resolve6(hostname: string, options: ResolveOptions, callback: (err: NodeJS.ErrnoException | null, addresses: string[] | RecordWithTtl[]) => void): void;
|
|
207
|
+
|
|
208
|
+
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
|
|
209
|
+
export namespace resolve6 {
|
|
210
|
+
function __promisify__(hostname: string): Promise<string[]>;
|
|
211
|
+
function __promisify__(hostname: string, options: ResolveWithTtlOptions): Promise<RecordWithTtl[]>;
|
|
212
|
+
function __promisify__(hostname: string, options?: ResolveOptions): Promise<string[] | RecordWithTtl[]>;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
export function resolveCname(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
|
|
216
|
+
export namespace resolveCname {
|
|
217
|
+
function __promisify__(hostname: string): Promise<string[]>;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
export function resolveCaa(hostname: string, callback: (err: NodeJS.ErrnoException | null, records: CaaRecord[]) => void): void;
|
|
221
|
+
export namespace resolveCaa {
|
|
222
|
+
function __promisify__(hostname: string): Promise<CaaRecord[]>;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
export function resolveMx(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void): void;
|
|
226
|
+
export namespace resolveMx {
|
|
227
|
+
function __promisify__(hostname: string): Promise<MxRecord[]>;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
export function resolveNaptr(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void): void;
|
|
231
|
+
export namespace resolveNaptr {
|
|
232
|
+
function __promisify__(hostname: string): Promise<NaptrRecord[]>;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
export function resolveNs(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
|
|
236
|
+
export namespace resolveNs {
|
|
237
|
+
function __promisify__(hostname: string): Promise<string[]>;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
export function resolvePtr(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
|
|
241
|
+
export namespace resolvePtr {
|
|
242
|
+
function __promisify__(hostname: string): Promise<string[]>;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
export function resolveSoa(hostname: string, callback: (err: NodeJS.ErrnoException | null, address: SoaRecord) => void): void;
|
|
246
|
+
export namespace resolveSoa {
|
|
247
|
+
function __promisify__(hostname: string): Promise<SoaRecord>;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
export function resolveSrv(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void): void;
|
|
251
|
+
export namespace resolveSrv {
|
|
252
|
+
function __promisify__(hostname: string): Promise<SrvRecord[]>;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
export function resolveTxt(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void): void;
|
|
256
|
+
export namespace resolveTxt {
|
|
257
|
+
function __promisify__(hostname: string): Promise<string[][]>;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
export function resolveAny(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: AnyRecord[]) => void): void;
|
|
261
|
+
export namespace resolveAny {
|
|
262
|
+
function __promisify__(hostname: string): Promise<AnyRecord[]>;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
export function reverse(ip: string, callback: (err: NodeJS.ErrnoException | null, hostnames: string[]) => void): void;
|
|
266
|
+
export function setServers(servers: ReadonlyArray<string>): void;
|
|
267
|
+
export function getServers(): string[];
|
|
268
|
+
|
|
269
|
+
// Error codes
|
|
270
|
+
export const NODATA: string;
|
|
271
|
+
export const FORMERR: string;
|
|
272
|
+
export const SERVFAIL: string;
|
|
273
|
+
export const NOTFOUND: string;
|
|
274
|
+
export const NOTIMP: string;
|
|
275
|
+
export const REFUSED: string;
|
|
276
|
+
export const BADQUERY: string;
|
|
277
|
+
export const BADNAME: string;
|
|
278
|
+
export const BADFAMILY: string;
|
|
279
|
+
export const BADRESP: string;
|
|
280
|
+
export const CONNREFUSED: string;
|
|
281
|
+
export const TIMEOUT: string;
|
|
282
|
+
export const EOF: string;
|
|
283
|
+
export const FILE: string;
|
|
284
|
+
export const NOMEM: string;
|
|
285
|
+
export const DESTRUCTION: string;
|
|
286
|
+
export const BADSTR: string;
|
|
287
|
+
export const BADFLAGS: string;
|
|
288
|
+
export const NONAME: string;
|
|
289
|
+
export const BADHINTS: string;
|
|
290
|
+
export const NOTINITIALIZED: string;
|
|
291
|
+
export const LOADIPHLPAPI: string;
|
|
292
|
+
export const ADDRGETNETWORKPARAMS: string;
|
|
293
|
+
export const CANCELLED: string;
|
|
294
|
+
|
|
295
|
+
export interface ResolverOptions {
|
|
296
|
+
timeout?: number;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
export class Resolver {
|
|
300
|
+
constructor(options?: ResolverOptions);
|
|
301
|
+
|
|
302
|
+
cancel(): void;
|
|
303
|
+
getServers: typeof getServers;
|
|
304
|
+
resolve: typeof resolve;
|
|
305
|
+
resolve4: typeof resolve4;
|
|
306
|
+
resolve6: typeof resolve6;
|
|
307
|
+
resolveAny: typeof resolveAny;
|
|
308
|
+
resolveCname: typeof resolveCname;
|
|
309
|
+
resolveMx: typeof resolveMx;
|
|
310
|
+
resolveNaptr: typeof resolveNaptr;
|
|
311
|
+
resolveNs: typeof resolveNs;
|
|
312
|
+
resolvePtr: typeof resolvePtr;
|
|
313
|
+
resolveSoa: typeof resolveSoa;
|
|
314
|
+
resolveSrv: typeof resolveSrv;
|
|
315
|
+
resolveTxt: typeof resolveTxt;
|
|
316
|
+
reverse: typeof reverse;
|
|
317
|
+
setLocalAddress(ipv4?: string, ipv6?: string): void;
|
|
318
|
+
setServers: typeof setServers;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
export { dnsPromises as promises };
|
|
322
|
+
}
|
|
@@ -3,7 +3,7 @@ declare module 'events' {
|
|
|
3
3
|
/**
|
|
4
4
|
* Enables automatic capturing of promise rejection.
|
|
5
5
|
*/
|
|
6
|
-
captureRejections?: boolean
|
|
6
|
+
captureRejections?: boolean;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
interface NodeEventTarget {
|
|
@@ -14,13 +14,17 @@ declare module 'events' {
|
|
|
14
14
|
addEventListener(event: string, listener: (...args: any[]) => void, opts?: { once: boolean }): any;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
+
interface StaticEventEmitterOptions {
|
|
18
|
+
signal?: AbortSignal;
|
|
19
|
+
}
|
|
20
|
+
|
|
17
21
|
interface EventEmitter extends NodeJS.EventEmitter {}
|
|
18
22
|
class EventEmitter {
|
|
19
23
|
constructor(options?: EventEmitterOptions);
|
|
20
24
|
|
|
21
|
-
static once(emitter: NodeEventTarget, event: string | symbol): Promise<any[]>;
|
|
22
|
-
static once(emitter: DOMEventTarget, event: string): Promise<any[]>;
|
|
23
|
-
static on(emitter: NodeJS.EventEmitter, event: string): AsyncIterableIterator<any>;
|
|
25
|
+
static once(emitter: NodeEventTarget, event: string | symbol, options?: StaticEventEmitterOptions): Promise<any[]>;
|
|
26
|
+
static once(emitter: DOMEventTarget, event: string, options?: StaticEventEmitterOptions): Promise<any[]>;
|
|
27
|
+
static on(emitter: NodeJS.EventEmitter, event: string, options?: StaticEventEmitterOptions): AsyncIterableIterator<any>;
|
|
24
28
|
|
|
25
29
|
/** @deprecated since v4.0.0 */
|
|
26
30
|
static listenerCount(emitter: NodeJS.EventEmitter, event: string | symbol): number;
|
|
@@ -76,7 +80,3 @@ declare module 'events' {
|
|
|
76
80
|
|
|
77
81
|
export = EventEmitter;
|
|
78
82
|
}
|
|
79
|
-
declare module 'node:events' {
|
|
80
|
-
import events = require('events');
|
|
81
|
-
export = events;
|
|
82
|
-
}
|
|
@@ -34,7 +34,7 @@ declare module 'fs/promises' {
|
|
|
34
34
|
* If `mode` is a string, it is parsed as an octal integer.
|
|
35
35
|
* If `flag` is not supplied, the default of `'a'` is used.
|
|
36
36
|
*/
|
|
37
|
-
appendFile(data: string | Uint8Array, options?: BaseEncodingOptions & { mode?: Mode
|
|
37
|
+
appendFile(data: string | Uint8Array, options?: BaseEncodingOptions & { mode?: Mode, flag?: OpenMode } | BufferEncoding | null): Promise<void>;
|
|
38
38
|
|
|
39
39
|
/**
|
|
40
40
|
* Asynchronous fchown(2) - Change ownership of a file.
|
|
@@ -73,7 +73,7 @@ declare module 'fs/promises' {
|
|
|
73
73
|
* @param options An object that may contain an optional flag.
|
|
74
74
|
* If a flag is not provided, it defaults to `'r'`.
|
|
75
75
|
*/
|
|
76
|
-
readFile(options?: { encoding?: null
|
|
76
|
+
readFile(options?: { encoding?: null, flag?: OpenMode } | null): Promise<Buffer>;
|
|
77
77
|
|
|
78
78
|
/**
|
|
79
79
|
* Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically.
|
|
@@ -81,7 +81,7 @@ declare module 'fs/promises' {
|
|
|
81
81
|
* @param options An object that may contain an optional flag.
|
|
82
82
|
* If a flag is not provided, it defaults to `'r'`.
|
|
83
83
|
*/
|
|
84
|
-
readFile(options: { encoding: BufferEncoding, flag?: OpenMode
|
|
84
|
+
readFile(options: { encoding: BufferEncoding, flag?: OpenMode } | BufferEncoding): Promise<string>;
|
|
85
85
|
|
|
86
86
|
/**
|
|
87
87
|
* Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically.
|
|
@@ -89,12 +89,12 @@ declare module 'fs/promises' {
|
|
|
89
89
|
* @param options An object that may contain an optional flag.
|
|
90
90
|
* If a flag is not provided, it defaults to `'r'`.
|
|
91
91
|
*/
|
|
92
|
-
readFile(options?: BaseEncodingOptions & { flag?: OpenMode
|
|
92
|
+
readFile(options?: BaseEncodingOptions & { flag?: OpenMode } | BufferEncoding | null): Promise<string | Buffer>;
|
|
93
93
|
|
|
94
94
|
/**
|
|
95
95
|
* Asynchronous fstat(2) - Get file status.
|
|
96
96
|
*/
|
|
97
|
-
stat(opts?: StatOptions & { bigint?: false
|
|
97
|
+
stat(opts?: StatOptions & { bigint?: false }): Promise<Stats>;
|
|
98
98
|
stat(opts: StatOptions & { bigint: true }): Promise<BigIntStats>;
|
|
99
99
|
stat(opts?: StatOptions): Promise<Stats | BigIntStats>;
|
|
100
100
|
|
|
@@ -143,7 +143,7 @@ declare module 'fs/promises' {
|
|
|
143
143
|
* If `mode` is a string, it is parsed as an octal integer.
|
|
144
144
|
* If `flag` is not supplied, the default of `'w'` is used.
|
|
145
145
|
*/
|
|
146
|
-
writeFile(data: string | Uint8Array, options?: BaseEncodingOptions & { mode?: Mode
|
|
146
|
+
writeFile(data: string | Uint8Array, options?: BaseEncodingOptions & { mode?: Mode, flag?: OpenMode } | BufferEncoding | null): Promise<void>;
|
|
147
147
|
|
|
148
148
|
/**
|
|
149
149
|
* See `fs.writev` promisified version.
|
|
@@ -293,7 +293,7 @@ declare module 'fs/promises' {
|
|
|
293
293
|
* @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
|
|
294
294
|
* should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
|
|
295
295
|
*/
|
|
296
|
-
function mkdir(path: PathLike, options?: Mode | (MakeDirectoryOptions & { recursive?: false
|
|
296
|
+
function mkdir(path: PathLike, options?: Mode | (MakeDirectoryOptions & { recursive?: false; }) | null): Promise<void>;
|
|
297
297
|
|
|
298
298
|
/**
|
|
299
299
|
* Asynchronous mkdir(2) - create a directory.
|
|
@@ -308,21 +308,21 @@ declare module 'fs/promises' {
|
|
|
308
308
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
309
309
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
310
310
|
*/
|
|
311
|
-
function readdir(path: PathLike, options?: BaseEncodingOptions & { withFileTypes?: false
|
|
311
|
+
function readdir(path: PathLike, options?: BaseEncodingOptions & { withFileTypes?: false } | BufferEncoding | null): Promise<string[]>;
|
|
312
312
|
|
|
313
313
|
/**
|
|
314
314
|
* Asynchronous readdir(3) - read a directory.
|
|
315
315
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
316
316
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
317
317
|
*/
|
|
318
|
-
function readdir(path: PathLike, options: { encoding: "buffer"; withFileTypes?: false
|
|
318
|
+
function readdir(path: PathLike, options: { encoding: "buffer"; withFileTypes?: false } | "buffer"): Promise<Buffer[]>;
|
|
319
319
|
|
|
320
320
|
/**
|
|
321
321
|
* Asynchronous readdir(3) - read a directory.
|
|
322
322
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
323
323
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
324
324
|
*/
|
|
325
|
-
function readdir(path: PathLike, options?: BaseEncodingOptions & { withFileTypes?: false
|
|
325
|
+
function readdir(path: PathLike, options?: BaseEncodingOptions & { withFileTypes?: false } | BufferEncoding | null): Promise<string[] | Buffer[]>;
|
|
326
326
|
|
|
327
327
|
/**
|
|
328
328
|
* Asynchronous readdir(3) - read a directory.
|
|
@@ -365,7 +365,7 @@ declare module 'fs/promises' {
|
|
|
365
365
|
* Asynchronous lstat(2) - Get file status. Does not dereference symbolic links.
|
|
366
366
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
367
367
|
*/
|
|
368
|
-
function lstat(path: PathLike, opts?: StatOptions & { bigint?: false
|
|
368
|
+
function lstat(path: PathLike, opts?: StatOptions & { bigint?: false }): Promise<Stats>;
|
|
369
369
|
function lstat(path: PathLike, opts: StatOptions & { bigint: true }): Promise<BigIntStats>;
|
|
370
370
|
function lstat(path: PathLike, opts?: StatOptions): Promise<Stats | BigIntStats>;
|
|
371
371
|
|
|
@@ -373,7 +373,7 @@ declare module 'fs/promises' {
|
|
|
373
373
|
* Asynchronous stat(2) - Get file status.
|
|
374
374
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
375
375
|
*/
|
|
376
|
-
function stat(path: PathLike, opts?: StatOptions & { bigint?: false
|
|
376
|
+
function stat(path: PathLike, opts?: StatOptions & { bigint?: false }): Promise<Stats>;
|
|
377
377
|
function stat(path: PathLike, opts: StatOptions & { bigint: true }): Promise<BigIntStats>;
|
|
378
378
|
function stat(path: PathLike, opts?: StatOptions): Promise<Stats | BigIntStats>;
|
|
379
379
|
|
|
@@ -510,11 +510,7 @@ declare module 'fs/promises' {
|
|
|
510
510
|
* If `mode` is a string, it is parsed as an octal integer.
|
|
511
511
|
* If `flag` is not supplied, the default of `'w'` is used.
|
|
512
512
|
*/
|
|
513
|
-
function writeFile(
|
|
514
|
-
path: PathLike | FileHandle,
|
|
515
|
-
data: string | Uint8Array,
|
|
516
|
-
options?: BaseEncodingOptions & { mode?: Mode | undefined, flag?: OpenMode | undefined } | BufferEncoding | null
|
|
517
|
-
): Promise<void>;
|
|
513
|
+
function writeFile(path: PathLike | FileHandle, data: string | Uint8Array, options?: BaseEncodingOptions & { mode?: Mode, flag?: OpenMode } | BufferEncoding | null): Promise<void>;
|
|
518
514
|
|
|
519
515
|
/**
|
|
520
516
|
* Asynchronously append data to a file, creating the file if it does not exist.
|
|
@@ -528,11 +524,7 @@ declare module 'fs/promises' {
|
|
|
528
524
|
* If `mode` is a string, it is parsed as an octal integer.
|
|
529
525
|
* If `flag` is not supplied, the default of `'a'` is used.
|
|
530
526
|
*/
|
|
531
|
-
function appendFile(
|
|
532
|
-
path: PathLike | FileHandle,
|
|
533
|
-
data: string | Uint8Array,
|
|
534
|
-
options?: BaseEncodingOptions & { mode?: Mode | undefined, flag?: OpenMode | undefined } | BufferEncoding | null
|
|
535
|
-
): Promise<void>;
|
|
527
|
+
function appendFile(path: PathLike | FileHandle, data: string | Uint8Array, options?: BaseEncodingOptions & { mode?: Mode, flag?: OpenMode } | BufferEncoding | null): Promise<void>;
|
|
536
528
|
|
|
537
529
|
/**
|
|
538
530
|
* Asynchronously reads the entire contents of a file.
|
|
@@ -541,7 +533,7 @@ declare module 'fs/promises' {
|
|
|
541
533
|
* @param options An object that may contain an optional flag.
|
|
542
534
|
* If a flag is not provided, it defaults to `'r'`.
|
|
543
535
|
*/
|
|
544
|
-
function readFile(path: PathLike | FileHandle, options?: { encoding?: null
|
|
536
|
+
function readFile(path: PathLike | FileHandle, options?: { encoding?: null, flag?: OpenMode } | null): Promise<Buffer>;
|
|
545
537
|
|
|
546
538
|
/**
|
|
547
539
|
* Asynchronously reads the entire contents of a file.
|
|
@@ -550,7 +542,7 @@ declare module 'fs/promises' {
|
|
|
550
542
|
* @param options An object that may contain an optional flag.
|
|
551
543
|
* If a flag is not provided, it defaults to `'r'`.
|
|
552
544
|
*/
|
|
553
|
-
function readFile(path: PathLike | FileHandle, options: { encoding: BufferEncoding, flag?: OpenMode
|
|
545
|
+
function readFile(path: PathLike | FileHandle, options: { encoding: BufferEncoding, flag?: OpenMode } | BufferEncoding): Promise<string>;
|
|
554
546
|
|
|
555
547
|
/**
|
|
556
548
|
* Asynchronously reads the entire contents of a file.
|
|
@@ -559,10 +551,7 @@ declare module 'fs/promises' {
|
|
|
559
551
|
* @param options An object that may contain an optional flag.
|
|
560
552
|
* If a flag is not provided, it defaults to `'r'`.
|
|
561
553
|
*/
|
|
562
|
-
function readFile(path: PathLike | FileHandle, options?: BaseEncodingOptions & { flag?: OpenMode
|
|
554
|
+
function readFile(path: PathLike | FileHandle, options?: BaseEncodingOptions & { flag?: OpenMode } | BufferEncoding | null): Promise<string | Buffer>;
|
|
563
555
|
|
|
564
|
-
function opendir(path:
|
|
565
|
-
}
|
|
566
|
-
declare module 'node:fs/promises' {
|
|
567
|
-
export * from 'fs/promises';
|
|
556
|
+
function opendir(path: string, options?: OpenDirOptions): Promise<Dir>;
|
|
568
557
|
}
|