@types/node 16.18.53 → 16.18.54
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 v16.18/README.md +1 -1
- node v16.18/assert/strict.d.ts +4 -4
- node v16.18/assert.d.ts +48 -24
- node v16.18/async_hooks.d.ts +10 -7
- node v16.18/buffer.d.ts +47 -24
- node v16.18/child_process.d.ts +262 -122
- node v16.18/cluster.d.ts +107 -89
- node v16.18/console.d.ts +7 -7
- node v16.18/constants.d.ts +12 -11
- node v16.18/crypto.d.ts +738 -267
- node v16.18/dgram.d.ts +81 -45
- node v16.18/diagnostics_channel.d.ts +3 -3
- node v16.18/dns/promises.d.ts +28 -25
- node v16.18/dns.d.ts +202 -61
- node v16.18/domain.d.ts +4 -4
- node v16.18/events.d.ts +15 -7
- node v16.18/fs/promises.d.ts +93 -64
- node v16.18/fs.d.ts +485 -290
- node v16.18/globals.d.ts +13 -13
- node v16.18/http.d.ts +177 -177
- node v16.18/http2.d.ts +628 -376
- node v16.18/https.d.ts +107 -105
- node v16.18/module.d.ts +11 -8
- node v16.18/net.d.ts +106 -87
- node v16.18/os.d.ts +7 -7
- node v16.18/package.json +2 -2
- node v16.18/path.d.ts +13 -13
- node v16.18/perf_hooks.d.ts +17 -15
- node v16.18/process.d.ts +144 -124
- node v16.18/punycode.d.ts +3 -3
- node v16.18/querystring.d.ts +14 -4
- node v16.18/readline.d.ts +64 -54
- node v16.18/repl.d.ts +67 -61
- node v16.18/stream/consumers.d.ts +4 -4
- node v16.18/stream/promises.d.ts +56 -15
- node v16.18/stream/web.d.ts +19 -19
- node v16.18/stream.d.ts +314 -216
- node v16.18/string_decoder.d.ts +3 -3
- node v16.18/test.d.ts +2 -2
- node v16.18/timers/promises.d.ts +4 -4
- node v16.18/timers.d.ts +23 -8
- node v16.18/tls.d.ts +150 -71
- node v16.18/trace_events.d.ts +3 -3
- node v16.18/ts4.8/assert/strict.d.ts +4 -4
- node v16.18/ts4.8/assert.d.ts +48 -24
- node v16.18/ts4.8/async_hooks.d.ts +10 -7
- node v16.18/ts4.8/buffer.d.ts +47 -24
- node v16.18/ts4.8/child_process.d.ts +262 -122
- node v16.18/ts4.8/cluster.d.ts +107 -89
- node v16.18/ts4.8/console.d.ts +7 -7
- node v16.18/ts4.8/constants.d.ts +12 -11
- node v16.18/ts4.8/crypto.d.ts +738 -267
- node v16.18/ts4.8/dgram.d.ts +81 -45
- node v16.18/ts4.8/diagnostics_channel.d.ts +3 -3
- node v16.18/ts4.8/dns/promises.d.ts +28 -25
- node v16.18/ts4.8/dns.d.ts +202 -61
- node v16.18/ts4.8/domain.d.ts +4 -4
- node v16.18/ts4.8/events.d.ts +15 -7
- node v16.18/ts4.8/fs/promises.d.ts +93 -64
- node v16.18/ts4.8/fs.d.ts +485 -290
- node v16.18/ts4.8/globals.d.ts +13 -13
- node v16.18/ts4.8/http.d.ts +176 -176
- node v16.18/ts4.8/http2.d.ts +628 -376
- node v16.18/ts4.8/https.d.ts +107 -105
- node v16.18/ts4.8/module.d.ts +11 -8
- node v16.18/ts4.8/net.d.ts +106 -87
- node v16.18/ts4.8/os.d.ts +7 -7
- node v16.18/ts4.8/path.d.ts +13 -13
- node v16.18/ts4.8/perf_hooks.d.ts +17 -15
- node v16.18/ts4.8/process.d.ts +144 -124
- node v16.18/ts4.8/punycode.d.ts +3 -3
- node v16.18/ts4.8/querystring.d.ts +14 -4
- node v16.18/ts4.8/readline.d.ts +64 -54
- node v16.18/ts4.8/repl.d.ts +67 -61
- node v16.18/ts4.8/stream/consumers.d.ts +4 -4
- node v16.18/ts4.8/stream/promises.d.ts +56 -15
- node v16.18/ts4.8/stream/web.d.ts +19 -19
- node v16.18/ts4.8/stream.d.ts +309 -214
- node v16.18/ts4.8/string_decoder.d.ts +3 -3
- node v16.18/ts4.8/test.d.ts +2 -2
- node v16.18/ts4.8/timers/promises.d.ts +4 -4
- node v16.18/ts4.8/timers.d.ts +23 -8
- node v16.18/ts4.8/tls.d.ts +150 -71
- node v16.18/ts4.8/trace_events.d.ts +3 -3
- node v16.18/ts4.8/tty.d.ts +10 -10
- node v16.18/ts4.8/url.d.ts +26 -14
- node v16.18/ts4.8/util.d.ts +122 -51
- node v16.18/ts4.8/v8.d.ts +4 -4
- node v16.18/ts4.8/vm.d.ts +18 -18
- node v16.18/ts4.8/wasi.d.ts +3 -3
- node v16.18/ts4.8/worker_threads.d.ts +77 -77
- node v16.18/ts4.8/zlib.d.ts +9 -9
- node v16.18/tty.d.ts +10 -10
- node v16.18/url.d.ts +26 -14
- node v16.18/util.d.ts +122 -51
- node v16.18/v8.d.ts +4 -4
- node v16.18/vm.d.ts +18 -18
- node v16.18/wasi.d.ts +3 -3
- node v16.18/worker_threads.d.ts +77 -77
- node v16.18/zlib.d.ts +9 -9
node v16.18/ts4.8/fs.d.ts
CHANGED
|
@@ -18,11 +18,11 @@
|
|
|
18
18
|
* forms, and are accessible using both CommonJS syntax and ES6 Modules (ESM).
|
|
19
19
|
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/fs.js)
|
|
20
20
|
*/
|
|
21
|
-
declare module
|
|
22
|
-
import * as stream from
|
|
23
|
-
import { Abortable, EventEmitter } from
|
|
24
|
-
import { URL } from
|
|
25
|
-
import * as promises from
|
|
21
|
+
declare module "fs" {
|
|
22
|
+
import * as stream from "node:stream";
|
|
23
|
+
import { Abortable, EventEmitter } from "node:events";
|
|
24
|
+
import { URL } from "node:url";
|
|
25
|
+
import * as promises from "node:fs/promises";
|
|
26
26
|
export { promises };
|
|
27
27
|
/**
|
|
28
28
|
* Valid types for path values in "fs".
|
|
@@ -32,10 +32,10 @@ declare module 'fs' {
|
|
|
32
32
|
export type TimeLike = string | number | Date;
|
|
33
33
|
export type NoParamCallback = (err: NodeJS.ErrnoException | null) => void;
|
|
34
34
|
export type BufferEncodingOption =
|
|
35
|
-
|
|
|
35
|
+
| "buffer"
|
|
36
36
|
| {
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
encoding: "buffer";
|
|
38
|
+
};
|
|
39
39
|
export interface ObjectEncodingOptions {
|
|
40
40
|
encoding?: BufferEncoding | null | undefined;
|
|
41
41
|
}
|
|
@@ -295,25 +295,25 @@ declare module 'fs' {
|
|
|
295
295
|
* 2. error
|
|
296
296
|
*/
|
|
297
297
|
addListener(event: string, listener: (...args: any[]) => void): this;
|
|
298
|
-
addListener(event:
|
|
299
|
-
addListener(event:
|
|
300
|
-
addListener(event:
|
|
298
|
+
addListener(event: "change", listener: (eventType: string, filename: string | Buffer) => void): this;
|
|
299
|
+
addListener(event: "error", listener: (error: Error) => void): this;
|
|
300
|
+
addListener(event: "close", listener: () => void): this;
|
|
301
301
|
on(event: string, listener: (...args: any[]) => void): this;
|
|
302
|
-
on(event:
|
|
303
|
-
on(event:
|
|
304
|
-
on(event:
|
|
302
|
+
on(event: "change", listener: (eventType: string, filename: string | Buffer) => void): this;
|
|
303
|
+
on(event: "error", listener: (error: Error) => void): this;
|
|
304
|
+
on(event: "close", listener: () => void): this;
|
|
305
305
|
once(event: string, listener: (...args: any[]) => void): this;
|
|
306
|
-
once(event:
|
|
307
|
-
once(event:
|
|
308
|
-
once(event:
|
|
306
|
+
once(event: "change", listener: (eventType: string, filename: string | Buffer) => void): this;
|
|
307
|
+
once(event: "error", listener: (error: Error) => void): this;
|
|
308
|
+
once(event: "close", listener: () => void): this;
|
|
309
309
|
prependListener(event: string, listener: (...args: any[]) => void): this;
|
|
310
|
-
prependListener(event:
|
|
311
|
-
prependListener(event:
|
|
312
|
-
prependListener(event:
|
|
310
|
+
prependListener(event: "change", listener: (eventType: string, filename: string | Buffer) => void): this;
|
|
311
|
+
prependListener(event: "error", listener: (error: Error) => void): this;
|
|
312
|
+
prependListener(event: "close", listener: () => void): this;
|
|
313
313
|
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
|
314
|
-
prependOnceListener(event:
|
|
315
|
-
prependOnceListener(event:
|
|
316
|
-
prependOnceListener(event:
|
|
314
|
+
prependOnceListener(event: "change", listener: (eventType: string, filename: string | Buffer) => void): this;
|
|
315
|
+
prependOnceListener(event: "error", listener: (error: Error) => void): this;
|
|
316
|
+
prependOnceListener(event: "close", listener: () => void): this;
|
|
317
317
|
}
|
|
318
318
|
/**
|
|
319
319
|
* Instances of `fs.ReadStream` are created and returned using the {@link createReadStream} function.
|
|
@@ -345,55 +345,55 @@ declare module 'fs' {
|
|
|
345
345
|
* 2. close
|
|
346
346
|
* 3. ready
|
|
347
347
|
*/
|
|
348
|
-
addListener(event:
|
|
349
|
-
addListener(event:
|
|
350
|
-
addListener(event:
|
|
351
|
-
addListener(event:
|
|
352
|
-
addListener(event:
|
|
353
|
-
addListener(event:
|
|
354
|
-
addListener(event:
|
|
355
|
-
addListener(event:
|
|
356
|
-
addListener(event:
|
|
348
|
+
addListener(event: "close", listener: () => void): this;
|
|
349
|
+
addListener(event: "data", listener: (chunk: Buffer | string) => void): this;
|
|
350
|
+
addListener(event: "end", listener: () => void): this;
|
|
351
|
+
addListener(event: "error", listener: (err: Error) => void): this;
|
|
352
|
+
addListener(event: "open", listener: (fd: number) => void): this;
|
|
353
|
+
addListener(event: "pause", listener: () => void): this;
|
|
354
|
+
addListener(event: "readable", listener: () => void): this;
|
|
355
|
+
addListener(event: "ready", listener: () => void): this;
|
|
356
|
+
addListener(event: "resume", listener: () => void): this;
|
|
357
357
|
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
358
|
-
on(event:
|
|
359
|
-
on(event:
|
|
360
|
-
on(event:
|
|
361
|
-
on(event:
|
|
362
|
-
on(event:
|
|
363
|
-
on(event:
|
|
364
|
-
on(event:
|
|
365
|
-
on(event:
|
|
366
|
-
on(event:
|
|
358
|
+
on(event: "close", listener: () => void): this;
|
|
359
|
+
on(event: "data", listener: (chunk: Buffer | string) => void): this;
|
|
360
|
+
on(event: "end", listener: () => void): this;
|
|
361
|
+
on(event: "error", listener: (err: Error) => void): this;
|
|
362
|
+
on(event: "open", listener: (fd: number) => void): this;
|
|
363
|
+
on(event: "pause", listener: () => void): this;
|
|
364
|
+
on(event: "readable", listener: () => void): this;
|
|
365
|
+
on(event: "ready", listener: () => void): this;
|
|
366
|
+
on(event: "resume", listener: () => void): this;
|
|
367
367
|
on(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
368
|
-
once(event:
|
|
369
|
-
once(event:
|
|
370
|
-
once(event:
|
|
371
|
-
once(event:
|
|
372
|
-
once(event:
|
|
373
|
-
once(event:
|
|
374
|
-
once(event:
|
|
375
|
-
once(event:
|
|
376
|
-
once(event:
|
|
368
|
+
once(event: "close", listener: () => void): this;
|
|
369
|
+
once(event: "data", listener: (chunk: Buffer | string) => void): this;
|
|
370
|
+
once(event: "end", listener: () => void): this;
|
|
371
|
+
once(event: "error", listener: (err: Error) => void): this;
|
|
372
|
+
once(event: "open", listener: (fd: number) => void): this;
|
|
373
|
+
once(event: "pause", listener: () => void): this;
|
|
374
|
+
once(event: "readable", listener: () => void): this;
|
|
375
|
+
once(event: "ready", listener: () => void): this;
|
|
376
|
+
once(event: "resume", listener: () => void): this;
|
|
377
377
|
once(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
378
|
-
prependListener(event:
|
|
379
|
-
prependListener(event:
|
|
380
|
-
prependListener(event:
|
|
381
|
-
prependListener(event:
|
|
382
|
-
prependListener(event:
|
|
383
|
-
prependListener(event:
|
|
384
|
-
prependListener(event:
|
|
385
|
-
prependListener(event:
|
|
386
|
-
prependListener(event:
|
|
378
|
+
prependListener(event: "close", listener: () => void): this;
|
|
379
|
+
prependListener(event: "data", listener: (chunk: Buffer | string) => void): this;
|
|
380
|
+
prependListener(event: "end", listener: () => void): this;
|
|
381
|
+
prependListener(event: "error", listener: (err: Error) => void): this;
|
|
382
|
+
prependListener(event: "open", listener: (fd: number) => void): this;
|
|
383
|
+
prependListener(event: "pause", listener: () => void): this;
|
|
384
|
+
prependListener(event: "readable", listener: () => void): this;
|
|
385
|
+
prependListener(event: "ready", listener: () => void): this;
|
|
386
|
+
prependListener(event: "resume", listener: () => void): this;
|
|
387
387
|
prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
388
|
-
prependOnceListener(event:
|
|
389
|
-
prependOnceListener(event:
|
|
390
|
-
prependOnceListener(event:
|
|
391
|
-
prependOnceListener(event:
|
|
392
|
-
prependOnceListener(event:
|
|
393
|
-
prependOnceListener(event:
|
|
394
|
-
prependOnceListener(event:
|
|
395
|
-
prependOnceListener(event:
|
|
396
|
-
prependOnceListener(event:
|
|
388
|
+
prependOnceListener(event: "close", listener: () => void): this;
|
|
389
|
+
prependOnceListener(event: "data", listener: (chunk: Buffer | string) => void): this;
|
|
390
|
+
prependOnceListener(event: "end", listener: () => void): this;
|
|
391
|
+
prependOnceListener(event: "error", listener: (err: Error) => void): this;
|
|
392
|
+
prependOnceListener(event: "open", listener: (fd: number) => void): this;
|
|
393
|
+
prependOnceListener(event: "pause", listener: () => void): this;
|
|
394
|
+
prependOnceListener(event: "readable", listener: () => void): this;
|
|
395
|
+
prependOnceListener(event: "ready", listener: () => void): this;
|
|
396
|
+
prependOnceListener(event: "resume", listener: () => void): this;
|
|
397
397
|
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
398
398
|
}
|
|
399
399
|
/**
|
|
@@ -434,50 +434,50 @@ declare module 'fs' {
|
|
|
434
434
|
* 2. close
|
|
435
435
|
* 3. ready
|
|
436
436
|
*/
|
|
437
|
-
addListener(event:
|
|
438
|
-
addListener(event:
|
|
439
|
-
addListener(event:
|
|
440
|
-
addListener(event:
|
|
441
|
-
addListener(event:
|
|
442
|
-
addListener(event:
|
|
443
|
-
addListener(event:
|
|
444
|
-
addListener(event:
|
|
437
|
+
addListener(event: "close", listener: () => void): this;
|
|
438
|
+
addListener(event: "drain", listener: () => void): this;
|
|
439
|
+
addListener(event: "error", listener: (err: Error) => void): this;
|
|
440
|
+
addListener(event: "finish", listener: () => void): this;
|
|
441
|
+
addListener(event: "open", listener: (fd: number) => void): this;
|
|
442
|
+
addListener(event: "pipe", listener: (src: stream.Readable) => void): this;
|
|
443
|
+
addListener(event: "ready", listener: () => void): this;
|
|
444
|
+
addListener(event: "unpipe", listener: (src: stream.Readable) => void): this;
|
|
445
445
|
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
446
|
-
on(event:
|
|
447
|
-
on(event:
|
|
448
|
-
on(event:
|
|
449
|
-
on(event:
|
|
450
|
-
on(event:
|
|
451
|
-
on(event:
|
|
452
|
-
on(event:
|
|
453
|
-
on(event:
|
|
446
|
+
on(event: "close", listener: () => void): this;
|
|
447
|
+
on(event: "drain", listener: () => void): this;
|
|
448
|
+
on(event: "error", listener: (err: Error) => void): this;
|
|
449
|
+
on(event: "finish", listener: () => void): this;
|
|
450
|
+
on(event: "open", listener: (fd: number) => void): this;
|
|
451
|
+
on(event: "pipe", listener: (src: stream.Readable) => void): this;
|
|
452
|
+
on(event: "ready", listener: () => void): this;
|
|
453
|
+
on(event: "unpipe", listener: (src: stream.Readable) => void): this;
|
|
454
454
|
on(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
455
|
-
once(event:
|
|
456
|
-
once(event:
|
|
457
|
-
once(event:
|
|
458
|
-
once(event:
|
|
459
|
-
once(event:
|
|
460
|
-
once(event:
|
|
461
|
-
once(event:
|
|
462
|
-
once(event:
|
|
455
|
+
once(event: "close", listener: () => void): this;
|
|
456
|
+
once(event: "drain", listener: () => void): this;
|
|
457
|
+
once(event: "error", listener: (err: Error) => void): this;
|
|
458
|
+
once(event: "finish", listener: () => void): this;
|
|
459
|
+
once(event: "open", listener: (fd: number) => void): this;
|
|
460
|
+
once(event: "pipe", listener: (src: stream.Readable) => void): this;
|
|
461
|
+
once(event: "ready", listener: () => void): this;
|
|
462
|
+
once(event: "unpipe", listener: (src: stream.Readable) => void): this;
|
|
463
463
|
once(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
464
|
-
prependListener(event:
|
|
465
|
-
prependListener(event:
|
|
466
|
-
prependListener(event:
|
|
467
|
-
prependListener(event:
|
|
468
|
-
prependListener(event:
|
|
469
|
-
prependListener(event:
|
|
470
|
-
prependListener(event:
|
|
471
|
-
prependListener(event:
|
|
464
|
+
prependListener(event: "close", listener: () => void): this;
|
|
465
|
+
prependListener(event: "drain", listener: () => void): this;
|
|
466
|
+
prependListener(event: "error", listener: (err: Error) => void): this;
|
|
467
|
+
prependListener(event: "finish", listener: () => void): this;
|
|
468
|
+
prependListener(event: "open", listener: (fd: number) => void): this;
|
|
469
|
+
prependListener(event: "pipe", listener: (src: stream.Readable) => void): this;
|
|
470
|
+
prependListener(event: "ready", listener: () => void): this;
|
|
471
|
+
prependListener(event: "unpipe", listener: (src: stream.Readable) => void): this;
|
|
472
472
|
prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
473
|
-
prependOnceListener(event:
|
|
474
|
-
prependOnceListener(event:
|
|
475
|
-
prependOnceListener(event:
|
|
476
|
-
prependOnceListener(event:
|
|
477
|
-
prependOnceListener(event:
|
|
478
|
-
prependOnceListener(event:
|
|
479
|
-
prependOnceListener(event:
|
|
480
|
-
prependOnceListener(event:
|
|
473
|
+
prependOnceListener(event: "close", listener: () => void): this;
|
|
474
|
+
prependOnceListener(event: "drain", listener: () => void): this;
|
|
475
|
+
prependOnceListener(event: "error", listener: (err: Error) => void): this;
|
|
476
|
+
prependOnceListener(event: "finish", listener: () => void): this;
|
|
477
|
+
prependOnceListener(event: "open", listener: (fd: number) => void): this;
|
|
478
|
+
prependOnceListener(event: "pipe", listener: (src: stream.Readable) => void): this;
|
|
479
|
+
prependOnceListener(event: "ready", listener: () => void): this;
|
|
480
|
+
prependOnceListener(event: "unpipe", listener: (src: stream.Readable) => void): this;
|
|
481
481
|
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
482
482
|
}
|
|
483
483
|
/**
|
|
@@ -896,19 +896,23 @@ declare module 'fs' {
|
|
|
896
896
|
path: PathLike,
|
|
897
897
|
options:
|
|
898
898
|
| (StatOptions & {
|
|
899
|
-
|
|
900
|
-
|
|
899
|
+
bigint?: false | undefined;
|
|
900
|
+
})
|
|
901
901
|
| undefined,
|
|
902
|
-
callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void
|
|
902
|
+
callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void,
|
|
903
903
|
): void;
|
|
904
904
|
export function stat(
|
|
905
905
|
path: PathLike,
|
|
906
906
|
options: StatOptions & {
|
|
907
907
|
bigint: true;
|
|
908
908
|
},
|
|
909
|
-
callback: (err: NodeJS.ErrnoException | null, stats: BigIntStats) => void
|
|
909
|
+
callback: (err: NodeJS.ErrnoException | null, stats: BigIntStats) => void,
|
|
910
|
+
): void;
|
|
911
|
+
export function stat(
|
|
912
|
+
path: PathLike,
|
|
913
|
+
options: StatOptions | undefined,
|
|
914
|
+
callback: (err: NodeJS.ErrnoException | null, stats: Stats | BigIntStats) => void,
|
|
910
915
|
): void;
|
|
911
|
-
export function stat(path: PathLike, options: StatOptions | undefined, callback: (err: NodeJS.ErrnoException | null, stats: Stats | BigIntStats) => void): void;
|
|
912
916
|
export namespace stat {
|
|
913
917
|
/**
|
|
914
918
|
* Asynchronous stat(2) - Get file status.
|
|
@@ -918,13 +922,13 @@ declare module 'fs' {
|
|
|
918
922
|
path: PathLike,
|
|
919
923
|
options?: StatOptions & {
|
|
920
924
|
bigint?: false | undefined;
|
|
921
|
-
}
|
|
925
|
+
},
|
|
922
926
|
): Promise<Stats>;
|
|
923
927
|
function __promisify__(
|
|
924
928
|
path: PathLike,
|
|
925
929
|
options: StatOptions & {
|
|
926
930
|
bigint: true;
|
|
927
|
-
}
|
|
931
|
+
},
|
|
928
932
|
): Promise<BigIntStats>;
|
|
929
933
|
function __promisify__(path: PathLike, options?: StatOptions): Promise<Stats | BigIntStats>;
|
|
930
934
|
}
|
|
@@ -935,33 +939,33 @@ declare module 'fs' {
|
|
|
935
939
|
options?: StatSyncOptions & {
|
|
936
940
|
bigint?: false | undefined;
|
|
937
941
|
throwIfNoEntry: false;
|
|
938
|
-
}
|
|
942
|
+
},
|
|
939
943
|
): Stats | undefined;
|
|
940
944
|
(
|
|
941
945
|
path: PathLike,
|
|
942
946
|
options: StatSyncOptions & {
|
|
943
947
|
bigint: true;
|
|
944
948
|
throwIfNoEntry: false;
|
|
945
|
-
}
|
|
949
|
+
},
|
|
946
950
|
): BigIntStats | undefined;
|
|
947
951
|
(
|
|
948
952
|
path: PathLike,
|
|
949
953
|
options?: StatSyncOptions & {
|
|
950
954
|
bigint?: false | undefined;
|
|
951
|
-
}
|
|
955
|
+
},
|
|
952
956
|
): Stats;
|
|
953
957
|
(
|
|
954
958
|
path: PathLike,
|
|
955
959
|
options: StatSyncOptions & {
|
|
956
960
|
bigint: true;
|
|
957
|
-
}
|
|
961
|
+
},
|
|
958
962
|
): BigIntStats;
|
|
959
963
|
(
|
|
960
964
|
path: PathLike,
|
|
961
965
|
options: StatSyncOptions & {
|
|
962
966
|
bigint: boolean;
|
|
963
967
|
throwIfNoEntry?: false | undefined;
|
|
964
|
-
}
|
|
968
|
+
},
|
|
965
969
|
): Stats | BigIntStats;
|
|
966
970
|
(path: PathLike, options?: StatSyncOptions): Stats | BigIntStats | undefined;
|
|
967
971
|
}
|
|
@@ -981,19 +985,23 @@ declare module 'fs' {
|
|
|
981
985
|
fd: number,
|
|
982
986
|
options:
|
|
983
987
|
| (StatOptions & {
|
|
984
|
-
|
|
985
|
-
|
|
988
|
+
bigint?: false | undefined;
|
|
989
|
+
})
|
|
986
990
|
| undefined,
|
|
987
|
-
callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void
|
|
991
|
+
callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void,
|
|
988
992
|
): void;
|
|
989
993
|
export function fstat(
|
|
990
994
|
fd: number,
|
|
991
995
|
options: StatOptions & {
|
|
992
996
|
bigint: true;
|
|
993
997
|
},
|
|
994
|
-
callback: (err: NodeJS.ErrnoException | null, stats: BigIntStats) => void
|
|
998
|
+
callback: (err: NodeJS.ErrnoException | null, stats: BigIntStats) => void,
|
|
999
|
+
): void;
|
|
1000
|
+
export function fstat(
|
|
1001
|
+
fd: number,
|
|
1002
|
+
options: StatOptions | undefined,
|
|
1003
|
+
callback: (err: NodeJS.ErrnoException | null, stats: Stats | BigIntStats) => void,
|
|
995
1004
|
): void;
|
|
996
|
-
export function fstat(fd: number, options: StatOptions | undefined, callback: (err: NodeJS.ErrnoException | null, stats: Stats | BigIntStats) => void): void;
|
|
997
1005
|
export namespace fstat {
|
|
998
1006
|
/**
|
|
999
1007
|
* Asynchronous fstat(2) - Get file status.
|
|
@@ -1003,13 +1011,13 @@ declare module 'fs' {
|
|
|
1003
1011
|
fd: number,
|
|
1004
1012
|
options?: StatOptions & {
|
|
1005
1013
|
bigint?: false | undefined;
|
|
1006
|
-
}
|
|
1014
|
+
},
|
|
1007
1015
|
): Promise<Stats>;
|
|
1008
1016
|
function __promisify__(
|
|
1009
1017
|
fd: number,
|
|
1010
1018
|
options: StatOptions & {
|
|
1011
1019
|
bigint: true;
|
|
1012
|
-
}
|
|
1020
|
+
},
|
|
1013
1021
|
): Promise<BigIntStats>;
|
|
1014
1022
|
function __promisify__(fd: number, options?: StatOptions): Promise<Stats | BigIntStats>;
|
|
1015
1023
|
}
|
|
@@ -1021,13 +1029,13 @@ declare module 'fs' {
|
|
|
1021
1029
|
fd: number,
|
|
1022
1030
|
options?: StatOptions & {
|
|
1023
1031
|
bigint?: false | undefined;
|
|
1024
|
-
}
|
|
1032
|
+
},
|
|
1025
1033
|
): Stats;
|
|
1026
1034
|
export function fstatSync(
|
|
1027
1035
|
fd: number,
|
|
1028
1036
|
options: StatOptions & {
|
|
1029
1037
|
bigint: true;
|
|
1030
|
-
}
|
|
1038
|
+
},
|
|
1031
1039
|
): BigIntStats;
|
|
1032
1040
|
export function fstatSync(fd: number, options?: StatOptions): Stats | BigIntStats;
|
|
1033
1041
|
|
|
@@ -1044,19 +1052,23 @@ declare module 'fs' {
|
|
|
1044
1052
|
path: PathLike,
|
|
1045
1053
|
options:
|
|
1046
1054
|
| (StatOptions & {
|
|
1047
|
-
|
|
1048
|
-
|
|
1055
|
+
bigint?: false | undefined;
|
|
1056
|
+
})
|
|
1049
1057
|
| undefined,
|
|
1050
|
-
callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void
|
|
1058
|
+
callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void,
|
|
1051
1059
|
): void;
|
|
1052
1060
|
export function lstat(
|
|
1053
1061
|
path: PathLike,
|
|
1054
1062
|
options: StatOptions & {
|
|
1055
1063
|
bigint: true;
|
|
1056
1064
|
},
|
|
1057
|
-
callback: (err: NodeJS.ErrnoException | null, stats: BigIntStats) => void
|
|
1065
|
+
callback: (err: NodeJS.ErrnoException | null, stats: BigIntStats) => void,
|
|
1066
|
+
): void;
|
|
1067
|
+
export function lstat(
|
|
1068
|
+
path: PathLike,
|
|
1069
|
+
options: StatOptions | undefined,
|
|
1070
|
+
callback: (err: NodeJS.ErrnoException | null, stats: Stats | BigIntStats) => void,
|
|
1058
1071
|
): void;
|
|
1059
|
-
export function lstat(path: PathLike, options: StatOptions | undefined, callback: (err: NodeJS.ErrnoException | null, stats: Stats | BigIntStats) => void): void;
|
|
1060
1072
|
export namespace lstat {
|
|
1061
1073
|
/**
|
|
1062
1074
|
* Asynchronous lstat(2) - Get file status. Does not dereference symbolic links.
|
|
@@ -1066,13 +1078,13 @@ declare module 'fs' {
|
|
|
1066
1078
|
path: PathLike,
|
|
1067
1079
|
options?: StatOptions & {
|
|
1068
1080
|
bigint?: false | undefined;
|
|
1069
|
-
}
|
|
1081
|
+
},
|
|
1070
1082
|
): Promise<Stats>;
|
|
1071
1083
|
function __promisify__(
|
|
1072
1084
|
path: PathLike,
|
|
1073
1085
|
options: StatOptions & {
|
|
1074
1086
|
bigint: true;
|
|
1075
|
-
}
|
|
1087
|
+
},
|
|
1076
1088
|
): Promise<BigIntStats>;
|
|
1077
1089
|
function __promisify__(path: PathLike, options?: StatOptions): Promise<Stats | BigIntStats>;
|
|
1078
1090
|
}
|
|
@@ -1132,7 +1144,12 @@ declare module 'fs' {
|
|
|
1132
1144
|
* ```
|
|
1133
1145
|
* @since v0.1.31
|
|
1134
1146
|
*/
|
|
1135
|
-
export function symlink(
|
|
1147
|
+
export function symlink(
|
|
1148
|
+
target: PathLike,
|
|
1149
|
+
path: PathLike,
|
|
1150
|
+
type: symlink.Type | undefined | null,
|
|
1151
|
+
callback: NoParamCallback,
|
|
1152
|
+
): void;
|
|
1136
1153
|
/**
|
|
1137
1154
|
* Asynchronous symlink(2) - Create a new symbolic link to an existing file.
|
|
1138
1155
|
* @param target A path to an existing file. If a URL is provided, it must use the `file:` protocol.
|
|
@@ -1148,7 +1165,7 @@ declare module 'fs' {
|
|
|
1148
1165
|
* When using `'junction'`, the `target` argument will automatically be normalized to an absolute path.
|
|
1149
1166
|
*/
|
|
1150
1167
|
function __promisify__(target: PathLike, path: PathLike, type?: string | null): Promise<void>;
|
|
1151
|
-
type Type =
|
|
1168
|
+
type Type = "dir" | "file" | "junction";
|
|
1152
1169
|
}
|
|
1153
1170
|
/**
|
|
1154
1171
|
* Returns `undefined`.
|
|
@@ -1170,24 +1187,39 @@ declare module 'fs' {
|
|
|
1170
1187
|
* the link path returned will be passed as a `Buffer` object.
|
|
1171
1188
|
* @since v0.1.31
|
|
1172
1189
|
*/
|
|
1173
|
-
export function readlink(
|
|
1190
|
+
export function readlink(
|
|
1191
|
+
path: PathLike,
|
|
1192
|
+
options: EncodingOption,
|
|
1193
|
+
callback: (err: NodeJS.ErrnoException | null, linkString: string) => void,
|
|
1194
|
+
): void;
|
|
1174
1195
|
/**
|
|
1175
1196
|
* Asynchronous readlink(2) - read value of a symbolic link.
|
|
1176
1197
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1177
1198
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1178
1199
|
*/
|
|
1179
|
-
export function readlink(
|
|
1200
|
+
export function readlink(
|
|
1201
|
+
path: PathLike,
|
|
1202
|
+
options: BufferEncodingOption,
|
|
1203
|
+
callback: (err: NodeJS.ErrnoException | null, linkString: Buffer) => void,
|
|
1204
|
+
): void;
|
|
1180
1205
|
/**
|
|
1181
1206
|
* Asynchronous readlink(2) - read value of a symbolic link.
|
|
1182
1207
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1183
1208
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1184
1209
|
*/
|
|
1185
|
-
export function readlink(
|
|
1210
|
+
export function readlink(
|
|
1211
|
+
path: PathLike,
|
|
1212
|
+
options: EncodingOption,
|
|
1213
|
+
callback: (err: NodeJS.ErrnoException | null, linkString: string | Buffer) => void,
|
|
1214
|
+
): void;
|
|
1186
1215
|
/**
|
|
1187
1216
|
* Asynchronous readlink(2) - read value of a symbolic link.
|
|
1188
1217
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1189
1218
|
*/
|
|
1190
|
-
export function readlink(
|
|
1219
|
+
export function readlink(
|
|
1220
|
+
path: PathLike,
|
|
1221
|
+
callback: (err: NodeJS.ErrnoException | null, linkString: string) => void,
|
|
1222
|
+
): void;
|
|
1191
1223
|
export namespace readlink {
|
|
1192
1224
|
/**
|
|
1193
1225
|
* Asynchronous readlink(2) - read value of a symbolic link.
|
|
@@ -1258,24 +1290,39 @@ declare module 'fs' {
|
|
|
1258
1290
|
* dependent name for that object.
|
|
1259
1291
|
* @since v0.1.31
|
|
1260
1292
|
*/
|
|
1261
|
-
export function realpath(
|
|
1293
|
+
export function realpath(
|
|
1294
|
+
path: PathLike,
|
|
1295
|
+
options: EncodingOption,
|
|
1296
|
+
callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void,
|
|
1297
|
+
): void;
|
|
1262
1298
|
/**
|
|
1263
1299
|
* Asynchronous realpath(3) - return the canonicalized absolute pathname.
|
|
1264
1300
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1265
1301
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1266
1302
|
*/
|
|
1267
|
-
export function realpath(
|
|
1303
|
+
export function realpath(
|
|
1304
|
+
path: PathLike,
|
|
1305
|
+
options: BufferEncodingOption,
|
|
1306
|
+
callback: (err: NodeJS.ErrnoException | null, resolvedPath: Buffer) => void,
|
|
1307
|
+
): void;
|
|
1268
1308
|
/**
|
|
1269
1309
|
* Asynchronous realpath(3) - return the canonicalized absolute pathname.
|
|
1270
1310
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1271
1311
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1272
1312
|
*/
|
|
1273
|
-
export function realpath(
|
|
1313
|
+
export function realpath(
|
|
1314
|
+
path: PathLike,
|
|
1315
|
+
options: EncodingOption,
|
|
1316
|
+
callback: (err: NodeJS.ErrnoException | null, resolvedPath: string | Buffer) => void,
|
|
1317
|
+
): void;
|
|
1274
1318
|
/**
|
|
1275
1319
|
* Asynchronous realpath(3) - return the canonicalized absolute pathname.
|
|
1276
1320
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1277
1321
|
*/
|
|
1278
|
-
export function realpath(
|
|
1322
|
+
export function realpath(
|
|
1323
|
+
path: PathLike,
|
|
1324
|
+
callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void,
|
|
1325
|
+
): void;
|
|
1279
1326
|
export namespace realpath {
|
|
1280
1327
|
/**
|
|
1281
1328
|
* Asynchronous realpath(3) - return the canonicalized absolute pathname.
|
|
@@ -1312,10 +1359,25 @@ declare module 'fs' {
|
|
|
1312
1359
|
* this restriction.
|
|
1313
1360
|
* @since v9.2.0
|
|
1314
1361
|
*/
|
|
1315
|
-
function native(
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1362
|
+
function native(
|
|
1363
|
+
path: PathLike,
|
|
1364
|
+
options: EncodingOption,
|
|
1365
|
+
callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void,
|
|
1366
|
+
): void;
|
|
1367
|
+
function native(
|
|
1368
|
+
path: PathLike,
|
|
1369
|
+
options: BufferEncodingOption,
|
|
1370
|
+
callback: (err: NodeJS.ErrnoException | null, resolvedPath: Buffer) => void,
|
|
1371
|
+
): void;
|
|
1372
|
+
function native(
|
|
1373
|
+
path: PathLike,
|
|
1374
|
+
options: EncodingOption,
|
|
1375
|
+
callback: (err: NodeJS.ErrnoException | null, resolvedPath: string | Buffer) => void,
|
|
1376
|
+
): void;
|
|
1377
|
+
function native(
|
|
1378
|
+
path: PathLike,
|
|
1379
|
+
callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void,
|
|
1380
|
+
): void;
|
|
1319
1381
|
}
|
|
1320
1382
|
/**
|
|
1321
1383
|
* Returns the resolved pathname.
|
|
@@ -1529,7 +1591,7 @@ declare module 'fs' {
|
|
|
1529
1591
|
options: MakeDirectoryOptions & {
|
|
1530
1592
|
recursive: true;
|
|
1531
1593
|
},
|
|
1532
|
-
callback: (err: NodeJS.ErrnoException | null, path?: string) => void
|
|
1594
|
+
callback: (err: NodeJS.ErrnoException | null, path?: string) => void,
|
|
1533
1595
|
): void;
|
|
1534
1596
|
/**
|
|
1535
1597
|
* Asynchronous mkdir(2) - create a directory.
|
|
@@ -1542,11 +1604,11 @@ declare module 'fs' {
|
|
|
1542
1604
|
options:
|
|
1543
1605
|
| Mode
|
|
1544
1606
|
| (MakeDirectoryOptions & {
|
|
1545
|
-
|
|
1546
|
-
|
|
1607
|
+
recursive?: false | undefined;
|
|
1608
|
+
})
|
|
1547
1609
|
| null
|
|
1548
1610
|
| undefined,
|
|
1549
|
-
callback: NoParamCallback
|
|
1611
|
+
callback: NoParamCallback,
|
|
1550
1612
|
): void;
|
|
1551
1613
|
/**
|
|
1552
1614
|
* Asynchronous mkdir(2) - create a directory.
|
|
@@ -1554,7 +1616,11 @@ declare module 'fs' {
|
|
|
1554
1616
|
* @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
|
|
1555
1617
|
* should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
|
|
1556
1618
|
*/
|
|
1557
|
-
export function mkdir(
|
|
1619
|
+
export function mkdir(
|
|
1620
|
+
path: PathLike,
|
|
1621
|
+
options: Mode | MakeDirectoryOptions | null | undefined,
|
|
1622
|
+
callback: (err: NodeJS.ErrnoException | null, path?: string) => void,
|
|
1623
|
+
): void;
|
|
1558
1624
|
/**
|
|
1559
1625
|
* Asynchronous mkdir(2) - create a directory with a mode of `0o777`.
|
|
1560
1626
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
@@ -1571,7 +1637,7 @@ declare module 'fs' {
|
|
|
1571
1637
|
path: PathLike,
|
|
1572
1638
|
options: MakeDirectoryOptions & {
|
|
1573
1639
|
recursive: true;
|
|
1574
|
-
}
|
|
1640
|
+
},
|
|
1575
1641
|
): Promise<string | undefined>;
|
|
1576
1642
|
/**
|
|
1577
1643
|
* Asynchronous mkdir(2) - create a directory.
|
|
@@ -1584,9 +1650,9 @@ declare module 'fs' {
|
|
|
1584
1650
|
options?:
|
|
1585
1651
|
| Mode
|
|
1586
1652
|
| (MakeDirectoryOptions & {
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
| null
|
|
1653
|
+
recursive?: false | undefined;
|
|
1654
|
+
})
|
|
1655
|
+
| null,
|
|
1590
1656
|
): Promise<void>;
|
|
1591
1657
|
/**
|
|
1592
1658
|
* Asynchronous mkdir(2) - create a directory.
|
|
@@ -1594,7 +1660,10 @@ declare module 'fs' {
|
|
|
1594
1660
|
* @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
|
|
1595
1661
|
* should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
|
|
1596
1662
|
*/
|
|
1597
|
-
function __promisify__(
|
|
1663
|
+
function __promisify__(
|
|
1664
|
+
path: PathLike,
|
|
1665
|
+
options?: Mode | MakeDirectoryOptions | null,
|
|
1666
|
+
): Promise<string | undefined>;
|
|
1598
1667
|
}
|
|
1599
1668
|
/**
|
|
1600
1669
|
* Synchronously creates a directory. Returns `undefined`, or if `recursive` is`true`, the first directory path created.
|
|
@@ -1607,7 +1676,7 @@ declare module 'fs' {
|
|
|
1607
1676
|
path: PathLike,
|
|
1608
1677
|
options: MakeDirectoryOptions & {
|
|
1609
1678
|
recursive: true;
|
|
1610
|
-
}
|
|
1679
|
+
},
|
|
1611
1680
|
): string | undefined;
|
|
1612
1681
|
/**
|
|
1613
1682
|
* Synchronous mkdir(2) - create a directory.
|
|
@@ -1620,9 +1689,9 @@ declare module 'fs' {
|
|
|
1620
1689
|
options?:
|
|
1621
1690
|
| Mode
|
|
1622
1691
|
| (MakeDirectoryOptions & {
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
| null
|
|
1692
|
+
recursive?: false | undefined;
|
|
1693
|
+
})
|
|
1694
|
+
| null,
|
|
1626
1695
|
): void;
|
|
1627
1696
|
/**
|
|
1628
1697
|
* Synchronous mkdir(2) - create a directory.
|
|
@@ -1688,7 +1757,11 @@ declare module 'fs' {
|
|
|
1688
1757
|
* ```
|
|
1689
1758
|
* @since v5.10.0
|
|
1690
1759
|
*/
|
|
1691
|
-
export function mkdtemp(
|
|
1760
|
+
export function mkdtemp(
|
|
1761
|
+
prefix: string,
|
|
1762
|
+
options: EncodingOption,
|
|
1763
|
+
callback: (err: NodeJS.ErrnoException | null, folder: string) => void,
|
|
1764
|
+
): void;
|
|
1692
1765
|
/**
|
|
1693
1766
|
* Asynchronously creates a unique temporary directory.
|
|
1694
1767
|
* Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
|
|
@@ -1697,23 +1770,30 @@ declare module 'fs' {
|
|
|
1697
1770
|
export function mkdtemp(
|
|
1698
1771
|
prefix: string,
|
|
1699
1772
|
options:
|
|
1700
|
-
|
|
|
1773
|
+
| "buffer"
|
|
1701
1774
|
| {
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
callback: (err: NodeJS.ErrnoException | null, folder: Buffer) => void
|
|
1775
|
+
encoding: "buffer";
|
|
1776
|
+
},
|
|
1777
|
+
callback: (err: NodeJS.ErrnoException | null, folder: Buffer) => void,
|
|
1705
1778
|
): void;
|
|
1706
1779
|
/**
|
|
1707
1780
|
* Asynchronously creates a unique temporary directory.
|
|
1708
1781
|
* Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
|
|
1709
1782
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1710
1783
|
*/
|
|
1711
|
-
export function mkdtemp(
|
|
1784
|
+
export function mkdtemp(
|
|
1785
|
+
prefix: string,
|
|
1786
|
+
options: EncodingOption,
|
|
1787
|
+
callback: (err: NodeJS.ErrnoException | null, folder: string | Buffer) => void,
|
|
1788
|
+
): void;
|
|
1712
1789
|
/**
|
|
1713
1790
|
* Asynchronously creates a unique temporary directory.
|
|
1714
1791
|
* Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
|
|
1715
1792
|
*/
|
|
1716
|
-
export function mkdtemp(
|
|
1793
|
+
export function mkdtemp(
|
|
1794
|
+
prefix: string,
|
|
1795
|
+
callback: (err: NodeJS.ErrnoException | null, folder: string) => void,
|
|
1796
|
+
): void;
|
|
1717
1797
|
export namespace mkdtemp {
|
|
1718
1798
|
/**
|
|
1719
1799
|
* Asynchronously creates a unique temporary directory.
|
|
@@ -1774,13 +1854,13 @@ declare module 'fs' {
|
|
|
1774
1854
|
path: PathLike,
|
|
1775
1855
|
options:
|
|
1776
1856
|
| {
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1857
|
+
encoding: BufferEncoding | null;
|
|
1858
|
+
withFileTypes?: false | undefined;
|
|
1859
|
+
}
|
|
1780
1860
|
| BufferEncoding
|
|
1781
1861
|
| undefined
|
|
1782
1862
|
| null,
|
|
1783
|
-
callback: (err: NodeJS.ErrnoException | null, files: string[]) => void
|
|
1863
|
+
callback: (err: NodeJS.ErrnoException | null, files: string[]) => void,
|
|
1784
1864
|
): void;
|
|
1785
1865
|
/**
|
|
1786
1866
|
* Asynchronous readdir(3) - read a directory.
|
|
@@ -1791,11 +1871,11 @@ declare module 'fs' {
|
|
|
1791
1871
|
path: PathLike,
|
|
1792
1872
|
options:
|
|
1793
1873
|
| {
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
|
1798
|
-
callback: (err: NodeJS.ErrnoException | null, files: Buffer[]) => void
|
|
1874
|
+
encoding: "buffer";
|
|
1875
|
+
withFileTypes?: false | undefined;
|
|
1876
|
+
}
|
|
1877
|
+
| "buffer",
|
|
1878
|
+
callback: (err: NodeJS.ErrnoException | null, files: Buffer[]) => void,
|
|
1799
1879
|
): void;
|
|
1800
1880
|
/**
|
|
1801
1881
|
* Asynchronous readdir(3) - read a directory.
|
|
@@ -1806,18 +1886,21 @@ declare module 'fs' {
|
|
|
1806
1886
|
path: PathLike,
|
|
1807
1887
|
options:
|
|
1808
1888
|
| (ObjectEncodingOptions & {
|
|
1809
|
-
|
|
1810
|
-
|
|
1889
|
+
withFileTypes?: false | undefined;
|
|
1890
|
+
})
|
|
1811
1891
|
| BufferEncoding
|
|
1812
1892
|
| undefined
|
|
1813
1893
|
| null,
|
|
1814
|
-
callback: (err: NodeJS.ErrnoException | null, files: string[] | Buffer[]) => void
|
|
1894
|
+
callback: (err: NodeJS.ErrnoException | null, files: string[] | Buffer[]) => void,
|
|
1815
1895
|
): void;
|
|
1816
1896
|
/**
|
|
1817
1897
|
* Asynchronous readdir(3) - read a directory.
|
|
1818
1898
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1819
1899
|
*/
|
|
1820
|
-
export function readdir(
|
|
1900
|
+
export function readdir(
|
|
1901
|
+
path: PathLike,
|
|
1902
|
+
callback: (err: NodeJS.ErrnoException | null, files: string[]) => void,
|
|
1903
|
+
): void;
|
|
1821
1904
|
/**
|
|
1822
1905
|
* Asynchronous readdir(3) - read a directory.
|
|
1823
1906
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
@@ -1828,7 +1911,7 @@ declare module 'fs' {
|
|
|
1828
1911
|
options: ObjectEncodingOptions & {
|
|
1829
1912
|
withFileTypes: true;
|
|
1830
1913
|
},
|
|
1831
|
-
callback: (err: NodeJS.ErrnoException | null, files: Dirent[]) => void
|
|
1914
|
+
callback: (err: NodeJS.ErrnoException | null, files: Dirent[]) => void,
|
|
1832
1915
|
): void;
|
|
1833
1916
|
export namespace readdir {
|
|
1834
1917
|
/**
|
|
@@ -1840,11 +1923,11 @@ declare module 'fs' {
|
|
|
1840
1923
|
path: PathLike,
|
|
1841
1924
|
options?:
|
|
1842
1925
|
| {
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1926
|
+
encoding: BufferEncoding | null;
|
|
1927
|
+
withFileTypes?: false | undefined;
|
|
1928
|
+
}
|
|
1846
1929
|
| BufferEncoding
|
|
1847
|
-
| null
|
|
1930
|
+
| null,
|
|
1848
1931
|
): Promise<string[]>;
|
|
1849
1932
|
/**
|
|
1850
1933
|
* Asynchronous readdir(3) - read a directory.
|
|
@@ -1854,11 +1937,11 @@ declare module 'fs' {
|
|
|
1854
1937
|
function __promisify__(
|
|
1855
1938
|
path: PathLike,
|
|
1856
1939
|
options:
|
|
1857
|
-
|
|
|
1940
|
+
| "buffer"
|
|
1858
1941
|
| {
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1942
|
+
encoding: "buffer";
|
|
1943
|
+
withFileTypes?: false | undefined;
|
|
1944
|
+
},
|
|
1862
1945
|
): Promise<Buffer[]>;
|
|
1863
1946
|
/**
|
|
1864
1947
|
* Asynchronous readdir(3) - read a directory.
|
|
@@ -1869,10 +1952,10 @@ declare module 'fs' {
|
|
|
1869
1952
|
path: PathLike,
|
|
1870
1953
|
options?:
|
|
1871
1954
|
| (ObjectEncodingOptions & {
|
|
1872
|
-
|
|
1873
|
-
|
|
1955
|
+
withFileTypes?: false | undefined;
|
|
1956
|
+
})
|
|
1874
1957
|
| BufferEncoding
|
|
1875
|
-
| null
|
|
1958
|
+
| null,
|
|
1876
1959
|
): Promise<string[] | Buffer[]>;
|
|
1877
1960
|
/**
|
|
1878
1961
|
* Asynchronous readdir(3) - read a directory.
|
|
@@ -1883,7 +1966,7 @@ declare module 'fs' {
|
|
|
1883
1966
|
path: PathLike,
|
|
1884
1967
|
options: ObjectEncodingOptions & {
|
|
1885
1968
|
withFileTypes: true;
|
|
1886
|
-
}
|
|
1969
|
+
},
|
|
1887
1970
|
): Promise<Dirent[]>;
|
|
1888
1971
|
}
|
|
1889
1972
|
/**
|
|
@@ -1903,11 +1986,11 @@ declare module 'fs' {
|
|
|
1903
1986
|
path: PathLike,
|
|
1904
1987
|
options?:
|
|
1905
1988
|
| {
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1989
|
+
encoding: BufferEncoding | null;
|
|
1990
|
+
withFileTypes?: false | undefined;
|
|
1991
|
+
}
|
|
1909
1992
|
| BufferEncoding
|
|
1910
|
-
| null
|
|
1993
|
+
| null,
|
|
1911
1994
|
): string[];
|
|
1912
1995
|
/**
|
|
1913
1996
|
* Synchronous readdir(3) - read a directory.
|
|
@@ -1918,10 +2001,10 @@ declare module 'fs' {
|
|
|
1918
2001
|
path: PathLike,
|
|
1919
2002
|
options:
|
|
1920
2003
|
| {
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
|
2004
|
+
encoding: "buffer";
|
|
2005
|
+
withFileTypes?: false | undefined;
|
|
2006
|
+
}
|
|
2007
|
+
| "buffer",
|
|
1925
2008
|
): Buffer[];
|
|
1926
2009
|
/**
|
|
1927
2010
|
* Synchronous readdir(3) - read a directory.
|
|
@@ -1932,10 +2015,10 @@ declare module 'fs' {
|
|
|
1932
2015
|
path: PathLike,
|
|
1933
2016
|
options?:
|
|
1934
2017
|
| (ObjectEncodingOptions & {
|
|
1935
|
-
|
|
1936
|
-
|
|
2018
|
+
withFileTypes?: false | undefined;
|
|
2019
|
+
})
|
|
1937
2020
|
| BufferEncoding
|
|
1938
|
-
| null
|
|
2021
|
+
| null,
|
|
1939
2022
|
): string[] | Buffer[];
|
|
1940
2023
|
/**
|
|
1941
2024
|
* Synchronous readdir(3) - read a directory.
|
|
@@ -1946,7 +2029,7 @@ declare module 'fs' {
|
|
|
1946
2029
|
path: PathLike,
|
|
1947
2030
|
options: ObjectEncodingOptions & {
|
|
1948
2031
|
withFileTypes: true;
|
|
1949
|
-
}
|
|
2032
|
+
},
|
|
1950
2033
|
): Dirent[];
|
|
1951
2034
|
/**
|
|
1952
2035
|
* Closes the file descriptor. No arguments other than a possible exception are
|
|
@@ -1993,13 +2076,22 @@ declare module 'fs' {
|
|
|
1993
2076
|
* @param [flags='r'] See `support of file system `flags``.
|
|
1994
2077
|
* @param [mode=0o666]
|
|
1995
2078
|
*/
|
|
1996
|
-
export function open(
|
|
2079
|
+
export function open(
|
|
2080
|
+
path: PathLike,
|
|
2081
|
+
flags: OpenMode | undefined,
|
|
2082
|
+
mode: Mode | undefined | null,
|
|
2083
|
+
callback: (err: NodeJS.ErrnoException | null, fd: number) => void,
|
|
2084
|
+
): void;
|
|
1997
2085
|
/**
|
|
1998
2086
|
* Asynchronous open(2) - open and possibly create a file. If the file is created, its mode will be `0o666`.
|
|
1999
2087
|
* @param [flags='r'] See `support of file system `flags``.
|
|
2000
2088
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
2001
2089
|
*/
|
|
2002
|
-
export function open(
|
|
2090
|
+
export function open(
|
|
2091
|
+
path: PathLike,
|
|
2092
|
+
flags: OpenMode | undefined,
|
|
2093
|
+
callback: (err: NodeJS.ErrnoException | null, fd: number) => void,
|
|
2094
|
+
): void;
|
|
2003
2095
|
/**
|
|
2004
2096
|
* Asynchronous open(2) - open and possibly create a file. If the file is created, its mode will be `0o666`.
|
|
2005
2097
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
@@ -2123,7 +2215,7 @@ declare module 'fs' {
|
|
|
2123
2215
|
offset: number | undefined | null,
|
|
2124
2216
|
length: number | undefined | null,
|
|
2125
2217
|
position: number | undefined | null,
|
|
2126
|
-
callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void
|
|
2218
|
+
callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void,
|
|
2127
2219
|
): void;
|
|
2128
2220
|
/**
|
|
2129
2221
|
* Asynchronously writes `buffer` to the file referenced by the supplied file descriptor.
|
|
@@ -2136,7 +2228,7 @@ declare module 'fs' {
|
|
|
2136
2228
|
buffer: TBuffer,
|
|
2137
2229
|
offset: number | undefined | null,
|
|
2138
2230
|
length: number | undefined | null,
|
|
2139
|
-
callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void
|
|
2231
|
+
callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void,
|
|
2140
2232
|
): void;
|
|
2141
2233
|
/**
|
|
2142
2234
|
* Asynchronously writes `buffer` to the file referenced by the supplied file descriptor.
|
|
@@ -2147,13 +2239,17 @@ declare module 'fs' {
|
|
|
2147
2239
|
fd: number,
|
|
2148
2240
|
buffer: TBuffer,
|
|
2149
2241
|
offset: number | undefined | null,
|
|
2150
|
-
callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void
|
|
2242
|
+
callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void,
|
|
2151
2243
|
): void;
|
|
2152
2244
|
/**
|
|
2153
2245
|
* Asynchronously writes `buffer` to the file referenced by the supplied file descriptor.
|
|
2154
2246
|
* @param fd A file descriptor.
|
|
2155
2247
|
*/
|
|
2156
|
-
export function write<TBuffer extends NodeJS.ArrayBufferView>(
|
|
2248
|
+
export function write<TBuffer extends NodeJS.ArrayBufferView>(
|
|
2249
|
+
fd: number,
|
|
2250
|
+
buffer: TBuffer,
|
|
2251
|
+
callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void,
|
|
2252
|
+
): void;
|
|
2157
2253
|
/**
|
|
2158
2254
|
* Asynchronously writes `string` to the file referenced by the supplied file descriptor.
|
|
2159
2255
|
* @param fd A file descriptor.
|
|
@@ -2166,7 +2262,7 @@ declare module 'fs' {
|
|
|
2166
2262
|
string: string,
|
|
2167
2263
|
position: number | undefined | null,
|
|
2168
2264
|
encoding: BufferEncoding | undefined | null,
|
|
2169
|
-
callback: (err: NodeJS.ErrnoException | null, written: number, str: string) => void
|
|
2265
|
+
callback: (err: NodeJS.ErrnoException | null, written: number, str: string) => void,
|
|
2170
2266
|
): void;
|
|
2171
2267
|
/**
|
|
2172
2268
|
* Asynchronously writes `string` to the file referenced by the supplied file descriptor.
|
|
@@ -2174,13 +2270,22 @@ declare module 'fs' {
|
|
|
2174
2270
|
* @param string A string to write.
|
|
2175
2271
|
* @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
|
|
2176
2272
|
*/
|
|
2177
|
-
export function write(
|
|
2273
|
+
export function write(
|
|
2274
|
+
fd: number,
|
|
2275
|
+
string: string,
|
|
2276
|
+
position: number | undefined | null,
|
|
2277
|
+
callback: (err: NodeJS.ErrnoException | null, written: number, str: string) => void,
|
|
2278
|
+
): void;
|
|
2178
2279
|
/**
|
|
2179
2280
|
* Asynchronously writes `string` to the file referenced by the supplied file descriptor.
|
|
2180
2281
|
* @param fd A file descriptor.
|
|
2181
2282
|
* @param string A string to write.
|
|
2182
2283
|
*/
|
|
2183
|
-
export function write(
|
|
2284
|
+
export function write(
|
|
2285
|
+
fd: number,
|
|
2286
|
+
string: string,
|
|
2287
|
+
callback: (err: NodeJS.ErrnoException | null, written: number, str: string) => void,
|
|
2288
|
+
): void;
|
|
2184
2289
|
export namespace write {
|
|
2185
2290
|
/**
|
|
2186
2291
|
* Asynchronously writes `buffer` to the file referenced by the supplied file descriptor.
|
|
@@ -2194,7 +2299,7 @@ declare module 'fs' {
|
|
|
2194
2299
|
buffer?: TBuffer,
|
|
2195
2300
|
offset?: number,
|
|
2196
2301
|
length?: number,
|
|
2197
|
-
position?: number | null
|
|
2302
|
+
position?: number | null,
|
|
2198
2303
|
): Promise<{
|
|
2199
2304
|
bytesWritten: number;
|
|
2200
2305
|
buffer: TBuffer;
|
|
@@ -2210,7 +2315,7 @@ declare module 'fs' {
|
|
|
2210
2315
|
fd: number,
|
|
2211
2316
|
string: string,
|
|
2212
2317
|
position?: number | null,
|
|
2213
|
-
encoding?: BufferEncoding | null
|
|
2318
|
+
encoding?: BufferEncoding | null,
|
|
2214
2319
|
): Promise<{
|
|
2215
2320
|
bytesWritten: number;
|
|
2216
2321
|
buffer: string;
|
|
@@ -2224,7 +2329,13 @@ declare module 'fs' {
|
|
|
2224
2329
|
* @since v0.1.21
|
|
2225
2330
|
* @return The number of bytes written.
|
|
2226
2331
|
*/
|
|
2227
|
-
export function writeSync(
|
|
2332
|
+
export function writeSync(
|
|
2333
|
+
fd: number,
|
|
2334
|
+
buffer: NodeJS.ArrayBufferView,
|
|
2335
|
+
offset?: number | null,
|
|
2336
|
+
length?: number | null,
|
|
2337
|
+
position?: number | null,
|
|
2338
|
+
): number;
|
|
2228
2339
|
/**
|
|
2229
2340
|
* Synchronously writes `string` to the file referenced by the supplied file descriptor, returning the number of bytes written.
|
|
2230
2341
|
* @param fd A file descriptor.
|
|
@@ -2232,7 +2343,12 @@ declare module 'fs' {
|
|
|
2232
2343
|
* @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
|
|
2233
2344
|
* @param encoding The expected string encoding.
|
|
2234
2345
|
*/
|
|
2235
|
-
export function writeSync(
|
|
2346
|
+
export function writeSync(
|
|
2347
|
+
fd: number,
|
|
2348
|
+
string: string,
|
|
2349
|
+
position?: number | null,
|
|
2350
|
+
encoding?: BufferEncoding | null,
|
|
2351
|
+
): number;
|
|
2236
2352
|
export type ReadPosition = number | bigint;
|
|
2237
2353
|
/**
|
|
2238
2354
|
* Read data from the file specified by `fd`.
|
|
@@ -2257,7 +2373,7 @@ declare module 'fs' {
|
|
|
2257
2373
|
offset: number,
|
|
2258
2374
|
length: number,
|
|
2259
2375
|
position: ReadPosition | null,
|
|
2260
|
-
callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: TBuffer) => void
|
|
2376
|
+
callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: TBuffer) => void,
|
|
2261
2377
|
): void;
|
|
2262
2378
|
export namespace read {
|
|
2263
2379
|
/**
|
|
@@ -2272,7 +2388,7 @@ declare module 'fs' {
|
|
|
2272
2388
|
buffer: TBuffer,
|
|
2273
2389
|
offset: number,
|
|
2274
2390
|
length: number,
|
|
2275
|
-
position: number | null
|
|
2391
|
+
position: number | null,
|
|
2276
2392
|
): Promise<{
|
|
2277
2393
|
bytesRead: number;
|
|
2278
2394
|
buffer: TBuffer;
|
|
@@ -2299,7 +2415,13 @@ declare module 'fs' {
|
|
|
2299
2415
|
* this API: {@link read}.
|
|
2300
2416
|
* @since v0.1.21
|
|
2301
2417
|
*/
|
|
2302
|
-
export function readSync(
|
|
2418
|
+
export function readSync(
|
|
2419
|
+
fd: number,
|
|
2420
|
+
buffer: NodeJS.ArrayBufferView,
|
|
2421
|
+
offset: number,
|
|
2422
|
+
length: number,
|
|
2423
|
+
position: ReadPosition | null,
|
|
2424
|
+
): number;
|
|
2303
2425
|
/**
|
|
2304
2426
|
* Similar to the above `fs.readSync` function, this version takes an optional `options` object.
|
|
2305
2427
|
* If no `options` object is specified, it will default with the above values.
|
|
@@ -2375,12 +2497,12 @@ declare module 'fs' {
|
|
|
2375
2497
|
path: PathOrFileDescriptor,
|
|
2376
2498
|
options:
|
|
2377
2499
|
| ({
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2500
|
+
encoding?: null | undefined;
|
|
2501
|
+
flag?: string | undefined;
|
|
2502
|
+
} & Abortable)
|
|
2381
2503
|
| undefined
|
|
2382
2504
|
| null,
|
|
2383
|
-
callback: (err: NodeJS.ErrnoException | null, data: Buffer) => void
|
|
2505
|
+
callback: (err: NodeJS.ErrnoException | null, data: Buffer) => void,
|
|
2384
2506
|
): void;
|
|
2385
2507
|
/**
|
|
2386
2508
|
* Asynchronously reads the entire contents of a file.
|
|
@@ -2393,11 +2515,11 @@ declare module 'fs' {
|
|
|
2393
2515
|
path: PathOrFileDescriptor,
|
|
2394
2516
|
options:
|
|
2395
2517
|
| ({
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2518
|
+
encoding: BufferEncoding;
|
|
2519
|
+
flag?: string | undefined;
|
|
2520
|
+
} & Abortable)
|
|
2399
2521
|
| BufferEncoding,
|
|
2400
|
-
callback: (err: NodeJS.ErrnoException | null, data: string) => void
|
|
2522
|
+
callback: (err: NodeJS.ErrnoException | null, data: string) => void,
|
|
2401
2523
|
): void;
|
|
2402
2524
|
/**
|
|
2403
2525
|
* Asynchronously reads the entire contents of a file.
|
|
@@ -2410,19 +2532,22 @@ declare module 'fs' {
|
|
|
2410
2532
|
path: PathOrFileDescriptor,
|
|
2411
2533
|
options:
|
|
2412
2534
|
| (ObjectEncodingOptions & {
|
|
2413
|
-
|
|
2414
|
-
|
|
2535
|
+
flag?: string | undefined;
|
|
2536
|
+
} & Abortable)
|
|
2415
2537
|
| BufferEncoding
|
|
2416
2538
|
| undefined
|
|
2417
2539
|
| null,
|
|
2418
|
-
callback: (err: NodeJS.ErrnoException | null, data: string | Buffer) => void
|
|
2540
|
+
callback: (err: NodeJS.ErrnoException | null, data: string | Buffer) => void,
|
|
2419
2541
|
): void;
|
|
2420
2542
|
/**
|
|
2421
2543
|
* Asynchronously reads the entire contents of a file.
|
|
2422
2544
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
2423
2545
|
* If a file descriptor is provided, the underlying file will _not_ be closed automatically.
|
|
2424
2546
|
*/
|
|
2425
|
-
export function readFile(
|
|
2547
|
+
export function readFile(
|
|
2548
|
+
path: PathOrFileDescriptor,
|
|
2549
|
+
callback: (err: NodeJS.ErrnoException | null, data: Buffer) => void,
|
|
2550
|
+
): void;
|
|
2426
2551
|
export namespace readFile {
|
|
2427
2552
|
/**
|
|
2428
2553
|
* Asynchronously reads the entire contents of a file.
|
|
@@ -2436,7 +2561,7 @@ declare module 'fs' {
|
|
|
2436
2561
|
options?: {
|
|
2437
2562
|
encoding?: null | undefined;
|
|
2438
2563
|
flag?: string | undefined;
|
|
2439
|
-
} | null
|
|
2564
|
+
} | null,
|
|
2440
2565
|
): Promise<Buffer>;
|
|
2441
2566
|
/**
|
|
2442
2567
|
* Asynchronously reads the entire contents of a file.
|
|
@@ -2450,10 +2575,10 @@ declare module 'fs' {
|
|
|
2450
2575
|
path: PathOrFileDescriptor,
|
|
2451
2576
|
options:
|
|
2452
2577
|
| {
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
| BufferEncoding
|
|
2578
|
+
encoding: BufferEncoding;
|
|
2579
|
+
flag?: string | undefined;
|
|
2580
|
+
}
|
|
2581
|
+
| BufferEncoding,
|
|
2457
2582
|
): Promise<string>;
|
|
2458
2583
|
/**
|
|
2459
2584
|
* Asynchronously reads the entire contents of a file.
|
|
@@ -2467,10 +2592,10 @@ declare module 'fs' {
|
|
|
2467
2592
|
path: PathOrFileDescriptor,
|
|
2468
2593
|
options?:
|
|
2469
2594
|
| (ObjectEncodingOptions & {
|
|
2470
|
-
|
|
2471
|
-
|
|
2595
|
+
flag?: string | undefined;
|
|
2596
|
+
})
|
|
2472
2597
|
| BufferEncoding
|
|
2473
|
-
| null
|
|
2598
|
+
| null,
|
|
2474
2599
|
): Promise<string | Buffer>;
|
|
2475
2600
|
}
|
|
2476
2601
|
/**
|
|
@@ -2502,7 +2627,7 @@ declare module 'fs' {
|
|
|
2502
2627
|
options?: {
|
|
2503
2628
|
encoding?: null | undefined;
|
|
2504
2629
|
flag?: string | undefined;
|
|
2505
|
-
} | null
|
|
2630
|
+
} | null,
|
|
2506
2631
|
): Buffer;
|
|
2507
2632
|
/**
|
|
2508
2633
|
* Synchronously reads the entire contents of a file.
|
|
@@ -2515,10 +2640,10 @@ declare module 'fs' {
|
|
|
2515
2640
|
path: PathOrFileDescriptor,
|
|
2516
2641
|
options:
|
|
2517
2642
|
| {
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
| BufferEncoding
|
|
2643
|
+
encoding: BufferEncoding;
|
|
2644
|
+
flag?: string | undefined;
|
|
2645
|
+
}
|
|
2646
|
+
| BufferEncoding,
|
|
2522
2647
|
): string;
|
|
2523
2648
|
/**
|
|
2524
2649
|
* Synchronously reads the entire contents of a file.
|
|
@@ -2531,17 +2656,20 @@ declare module 'fs' {
|
|
|
2531
2656
|
path: PathOrFileDescriptor,
|
|
2532
2657
|
options?:
|
|
2533
2658
|
| (ObjectEncodingOptions & {
|
|
2534
|
-
|
|
2535
|
-
|
|
2659
|
+
flag?: string | undefined;
|
|
2660
|
+
})
|
|
2536
2661
|
| BufferEncoding
|
|
2537
|
-
| null
|
|
2662
|
+
| null,
|
|
2538
2663
|
): string | Buffer;
|
|
2539
2664
|
export type WriteFileOptions =
|
|
2540
|
-
| (
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2665
|
+
| (
|
|
2666
|
+
& ObjectEncodingOptions
|
|
2667
|
+
& Abortable
|
|
2668
|
+
& {
|
|
2669
|
+
mode?: Mode | undefined;
|
|
2670
|
+
flag?: string | undefined;
|
|
2671
|
+
}
|
|
2672
|
+
)
|
|
2545
2673
|
| BufferEncoding
|
|
2546
2674
|
| null;
|
|
2547
2675
|
/**
|
|
@@ -2607,14 +2735,23 @@ declare module 'fs' {
|
|
|
2607
2735
|
* @since v0.1.29
|
|
2608
2736
|
* @param file filename or file descriptor
|
|
2609
2737
|
*/
|
|
2610
|
-
export function writeFile(
|
|
2738
|
+
export function writeFile(
|
|
2739
|
+
file: PathOrFileDescriptor,
|
|
2740
|
+
data: string | NodeJS.ArrayBufferView,
|
|
2741
|
+
options: WriteFileOptions,
|
|
2742
|
+
callback: NoParamCallback,
|
|
2743
|
+
): void;
|
|
2611
2744
|
/**
|
|
2612
2745
|
* Asynchronously writes data to a file, replacing the file if it already exists.
|
|
2613
2746
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
2614
2747
|
* If a file descriptor is provided, the underlying file will _not_ be closed automatically.
|
|
2615
2748
|
* @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string.
|
|
2616
2749
|
*/
|
|
2617
|
-
export function writeFile(
|
|
2750
|
+
export function writeFile(
|
|
2751
|
+
path: PathOrFileDescriptor,
|
|
2752
|
+
data: string | NodeJS.ArrayBufferView,
|
|
2753
|
+
callback: NoParamCallback,
|
|
2754
|
+
): void;
|
|
2618
2755
|
export namespace writeFile {
|
|
2619
2756
|
/**
|
|
2620
2757
|
* Asynchronously writes data to a file, replacing the file if it already exists.
|
|
@@ -2628,7 +2765,11 @@ declare module 'fs' {
|
|
|
2628
2765
|
* If `mode` is a string, it is parsed as an octal integer.
|
|
2629
2766
|
* If `flag` is not supplied, the default of `'w'` is used.
|
|
2630
2767
|
*/
|
|
2631
|
-
function __promisify__(
|
|
2768
|
+
function __promisify__(
|
|
2769
|
+
path: PathOrFileDescriptor,
|
|
2770
|
+
data: string | NodeJS.ArrayBufferView,
|
|
2771
|
+
options?: WriteFileOptions,
|
|
2772
|
+
): Promise<void>;
|
|
2632
2773
|
}
|
|
2633
2774
|
/**
|
|
2634
2775
|
* Returns `undefined`.
|
|
@@ -2642,7 +2783,11 @@ declare module 'fs' {
|
|
|
2642
2783
|
* @since v0.1.29
|
|
2643
2784
|
* @param file filename or file descriptor
|
|
2644
2785
|
*/
|
|
2645
|
-
export function writeFileSync(
|
|
2786
|
+
export function writeFileSync(
|
|
2787
|
+
file: PathOrFileDescriptor,
|
|
2788
|
+
data: string | NodeJS.ArrayBufferView,
|
|
2789
|
+
options?: WriteFileOptions,
|
|
2790
|
+
): void;
|
|
2646
2791
|
/**
|
|
2647
2792
|
* Asynchronously append data to a file, creating the file if it does not yet
|
|
2648
2793
|
* exist. `data` can be a string or a `Buffer`.
|
|
@@ -2696,7 +2841,12 @@ declare module 'fs' {
|
|
|
2696
2841
|
* @since v0.6.7
|
|
2697
2842
|
* @param path filename or file descriptor
|
|
2698
2843
|
*/
|
|
2699
|
-
export function appendFile(
|
|
2844
|
+
export function appendFile(
|
|
2845
|
+
path: PathOrFileDescriptor,
|
|
2846
|
+
data: string | Uint8Array,
|
|
2847
|
+
options: WriteFileOptions,
|
|
2848
|
+
callback: NoParamCallback,
|
|
2849
|
+
): void;
|
|
2700
2850
|
/**
|
|
2701
2851
|
* Asynchronously append data to a file, creating the file if it does not exist.
|
|
2702
2852
|
* @param file A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
@@ -2717,7 +2867,11 @@ declare module 'fs' {
|
|
|
2717
2867
|
* If `mode` is a string, it is parsed as an octal integer.
|
|
2718
2868
|
* If `flag` is not supplied, the default of `'a'` is used.
|
|
2719
2869
|
*/
|
|
2720
|
-
function __promisify__(
|
|
2870
|
+
function __promisify__(
|
|
2871
|
+
file: PathOrFileDescriptor,
|
|
2872
|
+
data: string | Uint8Array,
|
|
2873
|
+
options?: WriteFileOptions,
|
|
2874
|
+
): Promise<void>;
|
|
2721
2875
|
}
|
|
2722
2876
|
/**
|
|
2723
2877
|
* Synchronously append data to a file, creating the file if it does not yet
|
|
@@ -2766,7 +2920,11 @@ declare module 'fs' {
|
|
|
2766
2920
|
* @since v0.6.7
|
|
2767
2921
|
* @param path filename or file descriptor
|
|
2768
2922
|
*/
|
|
2769
|
-
export function appendFileSync(
|
|
2923
|
+
export function appendFileSync(
|
|
2924
|
+
path: PathOrFileDescriptor,
|
|
2925
|
+
data: string | Uint8Array,
|
|
2926
|
+
options?: WriteFileOptions,
|
|
2927
|
+
): void;
|
|
2770
2928
|
/**
|
|
2771
2929
|
* Watch for changes on `filename`. The callback `listener` will be called each
|
|
2772
2930
|
* time the file is accessed.
|
|
@@ -2822,19 +2980,19 @@ declare module 'fs' {
|
|
|
2822
2980
|
filename: PathLike,
|
|
2823
2981
|
options:
|
|
2824
2982
|
| (WatchFileOptions & {
|
|
2825
|
-
|
|
2826
|
-
|
|
2983
|
+
bigint?: false | undefined;
|
|
2984
|
+
})
|
|
2827
2985
|
| undefined,
|
|
2828
|
-
listener: StatsListener
|
|
2986
|
+
listener: StatsListener,
|
|
2829
2987
|
): StatWatcher;
|
|
2830
2988
|
export function watchFile(
|
|
2831
2989
|
filename: PathLike,
|
|
2832
2990
|
options:
|
|
2833
2991
|
| (WatchFileOptions & {
|
|
2834
|
-
|
|
2835
|
-
|
|
2992
|
+
bigint: true;
|
|
2993
|
+
})
|
|
2836
2994
|
| undefined,
|
|
2837
|
-
listener: BigIntStatsListener
|
|
2995
|
+
listener: BigIntStatsListener,
|
|
2838
2996
|
): StatWatcher;
|
|
2839
2997
|
/**
|
|
2840
2998
|
* Watch for changes on `filename`. The callback `listener` will be called each time the file is accessed.
|
|
@@ -2857,11 +3015,11 @@ declare module 'fs' {
|
|
|
2857
3015
|
export function unwatchFile(filename: PathLike, listener?: StatsListener): void;
|
|
2858
3016
|
export function unwatchFile(filename: PathLike, listener?: BigIntStatsListener): void;
|
|
2859
3017
|
export interface WatchOptions extends Abortable {
|
|
2860
|
-
encoding?: BufferEncoding |
|
|
3018
|
+
encoding?: BufferEncoding | "buffer" | undefined;
|
|
2861
3019
|
persistent?: boolean | undefined;
|
|
2862
3020
|
recursive?: boolean | undefined;
|
|
2863
3021
|
}
|
|
2864
|
-
export type WatchEventType =
|
|
3022
|
+
export type WatchEventType = "rename" | "change";
|
|
2865
3023
|
export type WatchListener<T> = (event: WatchEventType, filename: T | null) => void;
|
|
2866
3024
|
export type StatsListener = (curr: Stats, prev: Stats) => void;
|
|
2867
3025
|
export type BigIntStatsListener = (curr: BigIntStats, prev: BigIntStats) => void;
|
|
@@ -2889,10 +3047,10 @@ declare module 'fs' {
|
|
|
2889
3047
|
filename: PathLike,
|
|
2890
3048
|
options:
|
|
2891
3049
|
| (WatchOptions & {
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
|
2895
|
-
listener?: WatchListener<Buffer
|
|
3050
|
+
encoding: "buffer";
|
|
3051
|
+
})
|
|
3052
|
+
| "buffer",
|
|
3053
|
+
listener?: WatchListener<Buffer>,
|
|
2896
3054
|
): FSWatcher;
|
|
2897
3055
|
/**
|
|
2898
3056
|
* Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`.
|
|
@@ -2902,7 +3060,11 @@ declare module 'fs' {
|
|
|
2902
3060
|
* If `persistent` is not supplied, the default of `true` is used.
|
|
2903
3061
|
* If `recursive` is not supplied, the default of `false` is used.
|
|
2904
3062
|
*/
|
|
2905
|
-
export function watch(
|
|
3063
|
+
export function watch(
|
|
3064
|
+
filename: PathLike,
|
|
3065
|
+
options?: WatchOptions | BufferEncoding | null,
|
|
3066
|
+
listener?: WatchListener<string>,
|
|
3067
|
+
): FSWatcher;
|
|
2906
3068
|
/**
|
|
2907
3069
|
* Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`.
|
|
2908
3070
|
* @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
|
|
@@ -2911,7 +3073,11 @@ declare module 'fs' {
|
|
|
2911
3073
|
* If `persistent` is not supplied, the default of `true` is used.
|
|
2912
3074
|
* If `recursive` is not supplied, the default of `false` is used.
|
|
2913
3075
|
*/
|
|
2914
|
-
export function watch(
|
|
3076
|
+
export function watch(
|
|
3077
|
+
filename: PathLike,
|
|
3078
|
+
options: WatchOptions | string,
|
|
3079
|
+
listener?: WatchListener<string | Buffer>,
|
|
3080
|
+
): FSWatcher;
|
|
2915
3081
|
/**
|
|
2916
3082
|
* Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`.
|
|
2917
3083
|
* @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
|
|
@@ -3631,19 +3797,27 @@ declare module 'fs' {
|
|
|
3631
3797
|
* the end of the file.
|
|
3632
3798
|
* @since v12.9.0
|
|
3633
3799
|
*/
|
|
3634
|
-
export function writev(
|
|
3800
|
+
export function writev(
|
|
3801
|
+
fd: number,
|
|
3802
|
+
buffers: ReadonlyArray<NodeJS.ArrayBufferView>,
|
|
3803
|
+
cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers: NodeJS.ArrayBufferView[]) => void,
|
|
3804
|
+
): void;
|
|
3635
3805
|
export function writev(
|
|
3636
3806
|
fd: number,
|
|
3637
3807
|
buffers: ReadonlyArray<NodeJS.ArrayBufferView>,
|
|
3638
3808
|
position: number,
|
|
3639
|
-
cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers: NodeJS.ArrayBufferView[]) => void
|
|
3809
|
+
cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers: NodeJS.ArrayBufferView[]) => void,
|
|
3640
3810
|
): void;
|
|
3641
3811
|
export interface WriteVResult {
|
|
3642
3812
|
bytesWritten: number;
|
|
3643
3813
|
buffers: NodeJS.ArrayBufferView[];
|
|
3644
3814
|
}
|
|
3645
3815
|
export namespace writev {
|
|
3646
|
-
function __promisify__(
|
|
3816
|
+
function __promisify__(
|
|
3817
|
+
fd: number,
|
|
3818
|
+
buffers: ReadonlyArray<NodeJS.ArrayBufferView>,
|
|
3819
|
+
position?: number,
|
|
3820
|
+
): Promise<WriteVResult>;
|
|
3647
3821
|
}
|
|
3648
3822
|
/**
|
|
3649
3823
|
* For detailed information, see the documentation of the asynchronous version of
|
|
@@ -3666,19 +3840,27 @@ declare module 'fs' {
|
|
|
3666
3840
|
* a promise for an `Object` with `bytesRead` and `buffers` properties.
|
|
3667
3841
|
* @since v13.13.0, v12.17.0
|
|
3668
3842
|
*/
|
|
3669
|
-
export function readv(
|
|
3843
|
+
export function readv(
|
|
3844
|
+
fd: number,
|
|
3845
|
+
buffers: ReadonlyArray<NodeJS.ArrayBufferView>,
|
|
3846
|
+
cb: (err: NodeJS.ErrnoException | null, bytesRead: number, buffers: NodeJS.ArrayBufferView[]) => void,
|
|
3847
|
+
): void;
|
|
3670
3848
|
export function readv(
|
|
3671
3849
|
fd: number,
|
|
3672
3850
|
buffers: ReadonlyArray<NodeJS.ArrayBufferView>,
|
|
3673
3851
|
position: number,
|
|
3674
|
-
cb: (err: NodeJS.ErrnoException | null, bytesRead: number, buffers: NodeJS.ArrayBufferView[]) => void
|
|
3852
|
+
cb: (err: NodeJS.ErrnoException | null, bytesRead: number, buffers: NodeJS.ArrayBufferView[]) => void,
|
|
3675
3853
|
): void;
|
|
3676
3854
|
export interface ReadVResult {
|
|
3677
3855
|
bytesRead: number;
|
|
3678
3856
|
buffers: NodeJS.ArrayBufferView[];
|
|
3679
3857
|
}
|
|
3680
3858
|
export namespace readv {
|
|
3681
|
-
function __promisify__(
|
|
3859
|
+
function __promisify__(
|
|
3860
|
+
fd: number,
|
|
3861
|
+
buffers: ReadonlyArray<NodeJS.ArrayBufferView>,
|
|
3862
|
+
position?: number,
|
|
3863
|
+
): Promise<ReadVResult>;
|
|
3682
3864
|
}
|
|
3683
3865
|
/**
|
|
3684
3866
|
* For detailed information, see the documentation of the asynchronous version of
|
|
@@ -3720,7 +3902,11 @@ declare module 'fs' {
|
|
|
3720
3902
|
* @since v12.12.0
|
|
3721
3903
|
*/
|
|
3722
3904
|
export function opendir(path: PathLike, cb: (err: NodeJS.ErrnoException | null, dir: Dir) => void): void;
|
|
3723
|
-
export function opendir(
|
|
3905
|
+
export function opendir(
|
|
3906
|
+
path: PathLike,
|
|
3907
|
+
options: OpenDirOptions,
|
|
3908
|
+
cb: (err: NodeJS.ErrnoException | null, dir: Dir) => void,
|
|
3909
|
+
): void;
|
|
3724
3910
|
export namespace opendir {
|
|
3725
3911
|
function __promisify__(path: PathLike, options?: OpenDirOptions): Promise<Dir>;
|
|
3726
3912
|
}
|
|
@@ -3795,8 +3981,17 @@ declare module 'fs' {
|
|
|
3795
3981
|
* @param src source path to copy.
|
|
3796
3982
|
* @param dest destination path to copy to.
|
|
3797
3983
|
*/
|
|
3798
|
-
export function cp(
|
|
3799
|
-
|
|
3984
|
+
export function cp(
|
|
3985
|
+
source: string | URL,
|
|
3986
|
+
destination: string | URL,
|
|
3987
|
+
callback: (err: NodeJS.ErrnoException | null) => void,
|
|
3988
|
+
): void;
|
|
3989
|
+
export function cp(
|
|
3990
|
+
source: string | URL,
|
|
3991
|
+
destination: string | URL,
|
|
3992
|
+
opts: CopyOptions,
|
|
3993
|
+
callback: (err: NodeJS.ErrnoException | null) => void,
|
|
3994
|
+
): void;
|
|
3800
3995
|
/**
|
|
3801
3996
|
* Synchronously copies the entire directory structure from `src` to `dest`,
|
|
3802
3997
|
* including subdirectories and files.
|
|
@@ -3810,6 +4005,6 @@ declare module 'fs' {
|
|
|
3810
4005
|
*/
|
|
3811
4006
|
export function cpSync(source: string | URL, destination: string | URL, opts?: CopySyncOptions): void;
|
|
3812
4007
|
}
|
|
3813
|
-
declare module
|
|
3814
|
-
export * from
|
|
4008
|
+
declare module "node:fs" {
|
|
4009
|
+
export * from "fs";
|
|
3815
4010
|
}
|