@types/node 12.20.41 → 13.1.2
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 v12.20/LICENSE → node/LICENSE +21 -21
- node/README.md +16 -0
- node/assert.d.ts +50 -0
- node/async_hooks.d.ts +132 -0
- node/base.d.ts +41 -0
- node v12.20/buffer.d.ts → node/buffer.d.ts +1 -1
- node v12.20/child_process.d.ts → node/child_process.d.ts +111 -113
- node v12.20/cluster.d.ts → node/cluster.d.ts +25 -19
- node/console.d.ts +3 -0
- node/constants.d.ts +8 -0
- node/crypto.d.ts +615 -0
- node v12.20/dgram.d.ts → node/dgram.d.ts +48 -25
- node v12.20/dns.d.ts → node/dns.d.ts +6 -12
- node v12.20/domain.d.ts → node/domain.d.ts +2 -2
- node/events.d.ts +40 -0
- node v12.20/fs.d.ts → node/fs.d.ts +162 -262
- node v12.20/globals.d.ts → node/globals.d.ts +104 -260
- node v12.20/http.d.ts → node/http.d.ts +102 -177
- node v12.20/http2.d.ts → node/http2.d.ts +82 -87
- node/https.d.ts +53 -0
- node/index.d.ts +83 -0
- node v12.20/inspector.d.ts → node/inspector.d.ts +153 -159
- node/module.d.ts +20 -0
- node v12.20/net.d.ts → node/net.d.ts +37 -47
- node/os.d.ts +231 -0
- node v12.20/package.json → node/package.json +45 -9
- node/path.d.ts +153 -0
- node v12.20/perf_hooks.d.ts → node/perf_hooks.d.ts +76 -31
- node v12.20/process.d.ts → node/process.d.ts +2 -2
- node/punycode.d.ts +12 -0
- node v12.20/querystring.d.ts → node/querystring.d.ts +5 -5
- node v12.20/readline.d.ts → node/readline.d.ts +16 -17
- node v12.20/repl.d.ts → node/repl.d.ts +24 -32
- node v12.20/stream.d.ts → node/stream.d.ts +33 -43
- node v12.20/string_decoder.d.ts → node/string_decoder.d.ts +1 -1
- node v12.20/timers.d.ts → node/timers.d.ts +1 -1
- node v12.20/tls.d.ts → node/tls.d.ts +54 -65
- node v12.20/trace_events.d.ts → node/trace_events.d.ts +1 -1
- node/ts3.2/fs.d.ts +33 -0
- node/ts3.2/globals.d.ts +19 -0
- node/ts3.2/index.d.ts +16 -0
- node/ts3.2/util.d.ts +9 -0
- node v12.20/tty.d.ts → node/tty.d.ts +3 -3
- node v12.20/url.d.ts → node/url.d.ts +17 -24
- node v12.20/util.d.ts → node/util.d.ts +22 -37
- node v12.20/v8.d.ts → node/v8.d.ts +2 -12
- node v12.20/vm.d.ts → node/vm.d.ts +22 -24
- node v12.20/worker_threads.d.ts → node/worker_threads.d.ts +39 -85
- node v12.20/zlib.d.ts → node/zlib.d.ts +134 -138
- node v12.20/README.md +0 -16
- node v12.20/assert.d.ts +0 -117
- node v12.20/async_hooks.d.ts +0 -246
- node v12.20/console.d.ts +0 -3
- node v12.20/constants.d.ts +0 -448
- node v12.20/crypto.d.ts +0 -1159
- node v12.20/events.d.ts +0 -47
- node v12.20/globals.global.d.ts +0 -1
- node v12.20/https.d.ts +0 -156
- node v12.20/index.d.ts +0 -91
- node v12.20/module.d.ts +0 -3
- node v12.20/os.d.ts +0 -263
- node v12.20/path.d.ts +0 -159
- node v12.20/punycode.d.ts +0 -75
- node v12.20/wasi.d.ts +0 -55
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
declare module
|
|
2
|
-
import * as stream from
|
|
3
|
-
import
|
|
4
|
-
import { URL } from
|
|
1
|
+
declare module "fs" {
|
|
2
|
+
import * as stream from "stream";
|
|
3
|
+
import * as events from "events";
|
|
4
|
+
import { URL } from "url";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Valid types for path values in "fs".
|
|
@@ -19,20 +19,20 @@ declare module 'fs' {
|
|
|
19
19
|
isFIFO(): boolean;
|
|
20
20
|
isSocket(): boolean;
|
|
21
21
|
|
|
22
|
-
dev:
|
|
23
|
-
ino:
|
|
24
|
-
mode:
|
|
25
|
-
nlink:
|
|
26
|
-
uid:
|
|
27
|
-
gid:
|
|
28
|
-
rdev:
|
|
29
|
-
size:
|
|
30
|
-
blksize:
|
|
31
|
-
blocks:
|
|
32
|
-
atimeMs:
|
|
33
|
-
mtimeMs:
|
|
34
|
-
ctimeMs:
|
|
35
|
-
birthtimeMs:
|
|
22
|
+
dev: number;
|
|
23
|
+
ino: number;
|
|
24
|
+
mode: number;
|
|
25
|
+
nlink: number;
|
|
26
|
+
uid: number;
|
|
27
|
+
gid: number;
|
|
28
|
+
rdev: number;
|
|
29
|
+
size: number;
|
|
30
|
+
blksize: number;
|
|
31
|
+
blocks: number;
|
|
32
|
+
atimeMs: number;
|
|
33
|
+
mtimeMs: number;
|
|
34
|
+
ctimeMs: number;
|
|
35
|
+
birthtimeMs: number;
|
|
36
36
|
atime: Date;
|
|
37
37
|
mtime: Date;
|
|
38
38
|
ctime: Date;
|
|
@@ -96,7 +96,7 @@ declare module 'fs' {
|
|
|
96
96
|
readSync(): Dirent;
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
interface FSWatcher extends EventEmitter {
|
|
99
|
+
interface FSWatcher extends events.EventEmitter {
|
|
100
100
|
close(): void;
|
|
101
101
|
|
|
102
102
|
/**
|
|
@@ -131,7 +131,7 @@ declare module 'fs' {
|
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
class ReadStream extends stream.Readable {
|
|
134
|
-
close(
|
|
134
|
+
close(): void;
|
|
135
135
|
bytesRead: number;
|
|
136
136
|
path: string | Buffer;
|
|
137
137
|
|
|
@@ -162,7 +162,7 @@ declare module 'fs' {
|
|
|
162
162
|
}
|
|
163
163
|
|
|
164
164
|
class WriteStream extends stream.Writable {
|
|
165
|
-
close(
|
|
165
|
+
close(): void;
|
|
166
166
|
bytesWritten: number;
|
|
167
167
|
path: string | Buffer;
|
|
168
168
|
|
|
@@ -346,39 +346,6 @@ declare module 'fs' {
|
|
|
346
346
|
*/
|
|
347
347
|
function lchownSync(path: PathLike, uid: number, gid: number): void;
|
|
348
348
|
|
|
349
|
-
/**
|
|
350
|
-
* Changes the access and modification times of a file in the same way as `fs.utimes()`,
|
|
351
|
-
* with the difference that if the path refers to a symbolic link, then the link is not
|
|
352
|
-
* dereferenced: instead, the timestamps of the symbolic link itself are changed.
|
|
353
|
-
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
354
|
-
* @param atime The last access time. If a string is provided, it will be coerced to number.
|
|
355
|
-
* @param mtime The last modified time. If a string is provided, it will be coerced to number.
|
|
356
|
-
*/
|
|
357
|
-
function lutimes(path: PathLike, atime: string | number | Date, mtime: string | number | Date, callback: NoParamCallback): void;
|
|
358
|
-
|
|
359
|
-
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
|
|
360
|
-
namespace lutimes {
|
|
361
|
-
/**
|
|
362
|
-
* Changes the access and modification times of a file in the same way as `fsPromises.utimes()`,
|
|
363
|
-
* with the difference that if the path refers to a symbolic link, then the link is not
|
|
364
|
-
* dereferenced: instead, the timestamps of the symbolic link itself are changed.
|
|
365
|
-
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
366
|
-
* @param atime The last access time. If a string is provided, it will be coerced to number.
|
|
367
|
-
* @param mtime The last modified time. If a string is provided, it will be coerced to number.
|
|
368
|
-
*/
|
|
369
|
-
function __promisify__(path: PathLike, atime: string | number | Date, mtime: string | number | Date): Promise<void>;
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
/**
|
|
373
|
-
* Change the file system timestamps of the symbolic link referenced by `path`. Returns `undefined`,
|
|
374
|
-
* or throws an exception when parameters are incorrect or the operation fails.
|
|
375
|
-
* This is the synchronous version of `fs.lutimes()`.
|
|
376
|
-
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
377
|
-
* @param atime The last access time. If a string is provided, it will be coerced to number.
|
|
378
|
-
* @param mtime The last modified time. If a string is provided, it will be coerced to number.
|
|
379
|
-
*/
|
|
380
|
-
function lutimesSync(path: PathLike, atime: string | number | Date, mtime: string | number | Date): void;
|
|
381
|
-
|
|
382
349
|
/**
|
|
383
350
|
* Asynchronous chmod(2) - Change permissions of a file.
|
|
384
351
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
@@ -456,9 +423,6 @@ declare module 'fs' {
|
|
|
456
423
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
457
424
|
*/
|
|
458
425
|
function stat(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
|
|
459
|
-
function stat(path: PathLike, options: StatOptions & { bigint?: false | undefined } | undefined, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
|
|
460
|
-
function stat(path: PathLike, options: StatOptions & { bigint: true }, callback: (err: NodeJS.ErrnoException | null, stats: BigIntStats) => void): void;
|
|
461
|
-
function stat(path: PathLike, options: StatOptions | undefined, callback: (err: NodeJS.ErrnoException | null, stats: Stats | BigIntStats) => void): void;
|
|
462
426
|
|
|
463
427
|
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
|
|
464
428
|
namespace stat {
|
|
@@ -466,18 +430,20 @@ declare module 'fs' {
|
|
|
466
430
|
* Asynchronous stat(2) - Get file status.
|
|
467
431
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
468
432
|
*/
|
|
469
|
-
function __promisify__(path: PathLike
|
|
470
|
-
function __promisify__(path: PathLike, options: StatOptions & { bigint: true }): Promise<BigIntStats>;
|
|
471
|
-
function __promisify__(path: PathLike, options?: StatOptions): Promise<Stats | BigIntStats>;
|
|
433
|
+
function __promisify__(path: PathLike): Promise<Stats>;
|
|
472
434
|
}
|
|
473
435
|
|
|
474
436
|
/**
|
|
475
437
|
* Synchronous stat(2) - Get file status.
|
|
476
438
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
477
439
|
*/
|
|
478
|
-
function statSync(path: PathLike
|
|
479
|
-
|
|
480
|
-
|
|
440
|
+
function statSync(path: PathLike): Stats;
|
|
441
|
+
|
|
442
|
+
/**
|
|
443
|
+
* Asynchronous fstat(2) - Get file status.
|
|
444
|
+
* @param fd A file descriptor.
|
|
445
|
+
*/
|
|
446
|
+
function fstat(fd: number, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
|
|
481
447
|
|
|
482
448
|
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
|
|
483
449
|
namespace fstat {
|
|
@@ -485,27 +451,20 @@ declare module 'fs' {
|
|
|
485
451
|
* Asynchronous fstat(2) - Get file status.
|
|
486
452
|
* @param fd A file descriptor.
|
|
487
453
|
*/
|
|
488
|
-
function __promisify__(fd: number
|
|
489
|
-
function __promisify__(fd: number, options: StatOptions & { bigint: true }): Promise<BigIntStats>;
|
|
490
|
-
function __promisify__(fd: number, options?: StatOptions): Promise<Stats | BigIntStats>;
|
|
454
|
+
function __promisify__(fd: number): Promise<Stats>;
|
|
491
455
|
}
|
|
492
456
|
|
|
493
457
|
/**
|
|
494
458
|
* Synchronous fstat(2) - Get file status.
|
|
495
459
|
* @param fd A file descriptor.
|
|
496
460
|
*/
|
|
497
|
-
function fstatSync(fd: number
|
|
498
|
-
function fstatSync(fd: number, options: StatOptions & { bigint: true }): BigIntStats;
|
|
499
|
-
function fstatSync(fd: number, options?: StatOptions): Stats | BigIntStats;
|
|
461
|
+
function fstatSync(fd: number): Stats;
|
|
500
462
|
|
|
501
463
|
/**
|
|
502
464
|
* Asynchronous lstat(2) - Get file status. Does not dereference symbolic links.
|
|
503
465
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
504
466
|
*/
|
|
505
467
|
function lstat(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
|
|
506
|
-
function lstat(path: PathLike, options: StatOptions & { bigint?: false | undefined } | undefined, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
|
|
507
|
-
function lstat(path: PathLike, options: StatOptions & { bigint: true }, callback: (err: NodeJS.ErrnoException | null, stats: BigIntStats) => void): void;
|
|
508
|
-
function lstat(path: PathLike, options: StatOptions | undefined, callback: (err: NodeJS.ErrnoException | null, stats: Stats | BigIntStats) => void): void;
|
|
509
468
|
|
|
510
469
|
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
|
|
511
470
|
namespace lstat {
|
|
@@ -513,18 +472,14 @@ declare module 'fs' {
|
|
|
513
472
|
* Asynchronous lstat(2) - Get file status. Does not dereference symbolic links.
|
|
514
473
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
515
474
|
*/
|
|
516
|
-
function __promisify__(path: PathLike
|
|
517
|
-
function __promisify__(path: PathLike, options: StatOptions & { bigint: true }): Promise<BigIntStats>;
|
|
518
|
-
function __promisify__(path: PathLike, options?: StatOptions): Promise<Stats | BigIntStats>;
|
|
475
|
+
function __promisify__(path: PathLike): Promise<Stats>;
|
|
519
476
|
}
|
|
520
477
|
|
|
521
478
|
/**
|
|
522
479
|
* Synchronous lstat(2) - Get file status. Does not dereference symbolic links.
|
|
523
480
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
524
481
|
*/
|
|
525
|
-
function lstatSync(path: PathLike
|
|
526
|
-
function lstatSync(path: PathLike, options: StatOptions & { bigint: true }): BigIntStats;
|
|
527
|
-
function lstatSync(path: PathLike, options?: StatOptions): Stats | BigIntStats;
|
|
482
|
+
function lstatSync(path: PathLike): Stats;
|
|
528
483
|
|
|
529
484
|
/**
|
|
530
485
|
* Asynchronous link(2) - Create a new link (also known as a hard link) to an existing file.
|
|
@@ -596,7 +551,7 @@ declare module 'fs' {
|
|
|
596
551
|
*/
|
|
597
552
|
function readlink(
|
|
598
553
|
path: PathLike,
|
|
599
|
-
options: { encoding?: BufferEncoding | null
|
|
554
|
+
options: { encoding?: BufferEncoding | null } | BufferEncoding | undefined | null,
|
|
600
555
|
callback: (err: NodeJS.ErrnoException | null, linkString: string) => void
|
|
601
556
|
): void;
|
|
602
557
|
|
|
@@ -612,11 +567,7 @@ declare module 'fs' {
|
|
|
612
567
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
613
568
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
614
569
|
*/
|
|
615
|
-
function readlink(
|
|
616
|
-
path: PathLike,
|
|
617
|
-
options: { encoding?: string | null | undefined } | string | undefined | null,
|
|
618
|
-
callback: (err: NodeJS.ErrnoException | null, linkString: string | Buffer) => void
|
|
619
|
-
): void;
|
|
570
|
+
function readlink(path: PathLike, options: { encoding?: string | null } | string | undefined | null, callback: (err: NodeJS.ErrnoException | null, linkString: string | Buffer) => void): void;
|
|
620
571
|
|
|
621
572
|
/**
|
|
622
573
|
* Asynchronous readlink(2) - read value of a symbolic link.
|
|
@@ -631,7 +582,7 @@ declare module 'fs' {
|
|
|
631
582
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
632
583
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
633
584
|
*/
|
|
634
|
-
function __promisify__(path: PathLike, options?: { encoding?: BufferEncoding | null
|
|
585
|
+
function __promisify__(path: PathLike, options?: { encoding?: BufferEncoding | null } | BufferEncoding | null): Promise<string>;
|
|
635
586
|
|
|
636
587
|
/**
|
|
637
588
|
* Asynchronous readlink(2) - read value of a symbolic link.
|
|
@@ -645,7 +596,7 @@ declare module 'fs' {
|
|
|
645
596
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
646
597
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
647
598
|
*/
|
|
648
|
-
function __promisify__(path: PathLike, options?: { encoding?: string | null
|
|
599
|
+
function __promisify__(path: PathLike, options?: { encoding?: string | null } | string | null): Promise<string | Buffer>;
|
|
649
600
|
}
|
|
650
601
|
|
|
651
602
|
/**
|
|
@@ -653,7 +604,7 @@ declare module 'fs' {
|
|
|
653
604
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
654
605
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
655
606
|
*/
|
|
656
|
-
function readlinkSync(path: PathLike, options?: { encoding?: BufferEncoding | null
|
|
607
|
+
function readlinkSync(path: PathLike, options?: { encoding?: BufferEncoding | null } | BufferEncoding | null): string;
|
|
657
608
|
|
|
658
609
|
/**
|
|
659
610
|
* Synchronous readlink(2) - read value of a symbolic link.
|
|
@@ -667,7 +618,7 @@ declare module 'fs' {
|
|
|
667
618
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
668
619
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
669
620
|
*/
|
|
670
|
-
function readlinkSync(path: PathLike, options?: { encoding?: string | null
|
|
621
|
+
function readlinkSync(path: PathLike, options?: { encoding?: string | null } | string | null): string | Buffer;
|
|
671
622
|
|
|
672
623
|
/**
|
|
673
624
|
* Asynchronous realpath(3) - return the canonicalized absolute pathname.
|
|
@@ -676,7 +627,7 @@ declare module 'fs' {
|
|
|
676
627
|
*/
|
|
677
628
|
function realpath(
|
|
678
629
|
path: PathLike,
|
|
679
|
-
options: { encoding?: BufferEncoding | null
|
|
630
|
+
options: { encoding?: BufferEncoding | null } | BufferEncoding | undefined | null,
|
|
680
631
|
callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void
|
|
681
632
|
): void;
|
|
682
633
|
|
|
@@ -692,11 +643,7 @@ declare module 'fs' {
|
|
|
692
643
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
693
644
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
694
645
|
*/
|
|
695
|
-
function realpath(
|
|
696
|
-
path: PathLike,
|
|
697
|
-
options: { encoding?: string | null | undefined } | string | undefined | null,
|
|
698
|
-
callback: (err: NodeJS.ErrnoException | null, resolvedPath: string | Buffer) => void
|
|
699
|
-
): void;
|
|
646
|
+
function realpath(path: PathLike, options: { encoding?: string | null } | string | undefined | null, callback: (err: NodeJS.ErrnoException | null, resolvedPath: string | Buffer) => void): void;
|
|
700
647
|
|
|
701
648
|
/**
|
|
702
649
|
* Asynchronous realpath(3) - return the canonicalized absolute pathname.
|
|
@@ -711,7 +658,7 @@ declare module 'fs' {
|
|
|
711
658
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
712
659
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
713
660
|
*/
|
|
714
|
-
function __promisify__(path: PathLike, options?: { encoding?: BufferEncoding | null
|
|
661
|
+
function __promisify__(path: PathLike, options?: { encoding?: BufferEncoding | null } | BufferEncoding | null): Promise<string>;
|
|
715
662
|
|
|
716
663
|
/**
|
|
717
664
|
* Asynchronous realpath(3) - return the canonicalized absolute pathname.
|
|
@@ -725,19 +672,15 @@ declare module 'fs' {
|
|
|
725
672
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
726
673
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
727
674
|
*/
|
|
728
|
-
function __promisify__(path: PathLike, options?: { encoding?: string | null
|
|
675
|
+
function __promisify__(path: PathLike, options?: { encoding?: string | null } | string | null): Promise<string | Buffer>;
|
|
729
676
|
|
|
730
677
|
function native(
|
|
731
678
|
path: PathLike,
|
|
732
|
-
options: { encoding?: BufferEncoding | null
|
|
679
|
+
options: { encoding?: BufferEncoding | null } | BufferEncoding | undefined | null,
|
|
733
680
|
callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void
|
|
734
681
|
): void;
|
|
735
682
|
function native(path: PathLike, options: { encoding: "buffer" } | "buffer", callback: (err: NodeJS.ErrnoException | null, resolvedPath: Buffer) => void): void;
|
|
736
|
-
function native(
|
|
737
|
-
path: PathLike,
|
|
738
|
-
options: { encoding?: string | null | undefined } | string | undefined | null,
|
|
739
|
-
callback: (err: NodeJS.ErrnoException | null, resolvedPath: string | Buffer) => void
|
|
740
|
-
): void;
|
|
683
|
+
function native(path: PathLike, options: { encoding?: string | null } | string | undefined | null, callback: (err: NodeJS.ErrnoException | null, resolvedPath: string | Buffer) => void): void;
|
|
741
684
|
function native(path: PathLike, callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void): void;
|
|
742
685
|
}
|
|
743
686
|
|
|
@@ -746,7 +689,7 @@ declare module 'fs' {
|
|
|
746
689
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
747
690
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
748
691
|
*/
|
|
749
|
-
function realpathSync(path: PathLike, options?: { encoding?: BufferEncoding | null
|
|
692
|
+
function realpathSync(path: PathLike, options?: { encoding?: BufferEncoding | null } | BufferEncoding | null): string;
|
|
750
693
|
|
|
751
694
|
/**
|
|
752
695
|
* Synchronous realpath(3) - return the canonicalized absolute pathname.
|
|
@@ -760,12 +703,12 @@ declare module 'fs' {
|
|
|
760
703
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
761
704
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
762
705
|
*/
|
|
763
|
-
function realpathSync(path: PathLike, options?: { encoding?: string | null
|
|
706
|
+
function realpathSync(path: PathLike, options?: { encoding?: string | null } | string | null): string | Buffer;
|
|
764
707
|
|
|
765
708
|
namespace realpathSync {
|
|
766
|
-
function native(path: PathLike, options?: { encoding?: BufferEncoding | null
|
|
709
|
+
function native(path: PathLike, options?: { encoding?: BufferEncoding | null } | BufferEncoding | null): string;
|
|
767
710
|
function native(path: PathLike, options: { encoding: "buffer" } | "buffer"): Buffer;
|
|
768
|
-
function native(path: PathLike, options?: { encoding?: string | null
|
|
711
|
+
function native(path: PathLike, options?: { encoding?: string | null } | string | null): string | Buffer;
|
|
769
712
|
}
|
|
770
713
|
|
|
771
714
|
/**
|
|
@@ -790,14 +733,6 @@ declare module 'fs' {
|
|
|
790
733
|
function unlinkSync(path: PathLike): void;
|
|
791
734
|
|
|
792
735
|
interface RmDirOptions {
|
|
793
|
-
/**
|
|
794
|
-
* If an `EBUSY`, `ENOTEMPTY`, or `EPERM` error is
|
|
795
|
-
* encountered, Node.js will retry the operation with a linear backoff wait of
|
|
796
|
-
* 100ms longer on each try. This option represents the number of retries. This
|
|
797
|
-
* option is ignored if the `recursive` option is not `true`.
|
|
798
|
-
* @default 3
|
|
799
|
-
*/
|
|
800
|
-
maxRetries?: number | undefined;
|
|
801
736
|
/**
|
|
802
737
|
* If `true`, perform a recursive directory removal. In
|
|
803
738
|
* recursive mode, errors are not reported if `path` does not exist, and
|
|
@@ -805,7 +740,10 @@ declare module 'fs' {
|
|
|
805
740
|
* @experimental
|
|
806
741
|
* @default false
|
|
807
742
|
*/
|
|
808
|
-
recursive?: boolean
|
|
743
|
+
recursive?: boolean;
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
interface RmDirAsyncOptions extends RmDirOptions {
|
|
809
747
|
/**
|
|
810
748
|
* If an `EMFILE` error is encountered, Node.js will
|
|
811
749
|
* retry the operation with a linear backoff of 1ms longer on each try until the
|
|
@@ -813,7 +751,15 @@ declare module 'fs' {
|
|
|
813
751
|
* option is not `true`.
|
|
814
752
|
* @default 1000
|
|
815
753
|
*/
|
|
816
|
-
emfileWait?: number
|
|
754
|
+
emfileWait?: number;
|
|
755
|
+
/**
|
|
756
|
+
* If an `EBUSY`, `ENOTEMPTY`, or `EPERM` error is
|
|
757
|
+
* encountered, Node.js will retry the operation with a linear backoff wait of
|
|
758
|
+
* 100ms longer on each try. This option represents the number of retries. This
|
|
759
|
+
* option is ignored if the `recursive` option is not `true`.
|
|
760
|
+
* @default 3
|
|
761
|
+
*/
|
|
762
|
+
maxBusyTries?: number;
|
|
817
763
|
}
|
|
818
764
|
|
|
819
765
|
/**
|
|
@@ -821,7 +767,7 @@ declare module 'fs' {
|
|
|
821
767
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
822
768
|
*/
|
|
823
769
|
function rmdir(path: PathLike, callback: NoParamCallback): void;
|
|
824
|
-
function rmdir(path: PathLike, options:
|
|
770
|
+
function rmdir(path: PathLike, options: RmDirAsyncOptions, callback: NoParamCallback): void;
|
|
825
771
|
|
|
826
772
|
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
|
|
827
773
|
namespace rmdir {
|
|
@@ -829,7 +775,7 @@ declare module 'fs' {
|
|
|
829
775
|
* Asynchronous rmdir(2) - delete a directory.
|
|
830
776
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
831
777
|
*/
|
|
832
|
-
function __promisify__(path: PathLike, options?:
|
|
778
|
+
function __promisify__(path: PathLike, options?: RmDirAsyncOptions): Promise<void>;
|
|
833
779
|
}
|
|
834
780
|
|
|
835
781
|
/**
|
|
@@ -843,12 +789,12 @@ declare module 'fs' {
|
|
|
843
789
|
* Indicates whether parent folders should be created.
|
|
844
790
|
* @default false
|
|
845
791
|
*/
|
|
846
|
-
recursive?: boolean
|
|
792
|
+
recursive?: boolean;
|
|
847
793
|
/**
|
|
848
794
|
* A file mode. If a string is passed, it is parsed as an octal integer. If not specified
|
|
849
795
|
* @default 0o777.
|
|
850
796
|
*/
|
|
851
|
-
mode?: number
|
|
797
|
+
mode?: number;
|
|
852
798
|
}
|
|
853
799
|
|
|
854
800
|
/**
|
|
@@ -889,11 +835,7 @@ declare module 'fs' {
|
|
|
889
835
|
* Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
|
|
890
836
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
891
837
|
*/
|
|
892
|
-
function mkdtemp(
|
|
893
|
-
prefix: string,
|
|
894
|
-
options: { encoding?: BufferEncoding | null | undefined } | BufferEncoding | undefined | null,
|
|
895
|
-
callback: (err: NodeJS.ErrnoException | null, folder: string) => void
|
|
896
|
-
): void;
|
|
838
|
+
function mkdtemp(prefix: string, options: { encoding?: BufferEncoding | null } | BufferEncoding | undefined | null, callback: (err: NodeJS.ErrnoException | null, folder: string) => void): void;
|
|
897
839
|
|
|
898
840
|
/**
|
|
899
841
|
* Asynchronously creates a unique temporary directory.
|
|
@@ -907,11 +849,7 @@ declare module 'fs' {
|
|
|
907
849
|
* Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
|
|
908
850
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
909
851
|
*/
|
|
910
|
-
function mkdtemp(
|
|
911
|
-
prefix: string,
|
|
912
|
-
options: { encoding?: string | null | undefined } | string | undefined | null,
|
|
913
|
-
callback: (err: NodeJS.ErrnoException | null, folder: string | Buffer) => void
|
|
914
|
-
): void;
|
|
852
|
+
function mkdtemp(prefix: string, options: { encoding?: string | null } | string | undefined | null, callback: (err: NodeJS.ErrnoException | null, folder: string | Buffer) => void): void;
|
|
915
853
|
|
|
916
854
|
/**
|
|
917
855
|
* Asynchronously creates a unique temporary directory.
|
|
@@ -926,7 +864,7 @@ declare module 'fs' {
|
|
|
926
864
|
* Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
|
|
927
865
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
928
866
|
*/
|
|
929
|
-
function __promisify__(prefix: string, options?: { encoding?: BufferEncoding | null
|
|
867
|
+
function __promisify__(prefix: string, options?: { encoding?: BufferEncoding | null } | BufferEncoding | null): Promise<string>;
|
|
930
868
|
|
|
931
869
|
/**
|
|
932
870
|
* Asynchronously creates a unique temporary directory.
|
|
@@ -940,7 +878,7 @@ declare module 'fs' {
|
|
|
940
878
|
* Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
|
|
941
879
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
942
880
|
*/
|
|
943
|
-
function __promisify__(prefix: string, options?: { encoding?: string | null
|
|
881
|
+
function __promisify__(prefix: string, options?: { encoding?: string | null } | string | null): Promise<string | Buffer>;
|
|
944
882
|
}
|
|
945
883
|
|
|
946
884
|
/**
|
|
@@ -948,7 +886,7 @@ declare module 'fs' {
|
|
|
948
886
|
* Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
|
|
949
887
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
950
888
|
*/
|
|
951
|
-
function mkdtempSync(prefix: string, options?: { encoding?: BufferEncoding | null
|
|
889
|
+
function mkdtempSync(prefix: string, options?: { encoding?: BufferEncoding | null } | BufferEncoding | null): string;
|
|
952
890
|
|
|
953
891
|
/**
|
|
954
892
|
* Synchronously creates a unique temporary directory.
|
|
@@ -962,7 +900,7 @@ declare module 'fs' {
|
|
|
962
900
|
* Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
|
|
963
901
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
964
902
|
*/
|
|
965
|
-
function mkdtempSync(prefix: string, options?: { encoding?: string | null
|
|
903
|
+
function mkdtempSync(prefix: string, options?: { encoding?: string | null } | string | null): string | Buffer;
|
|
966
904
|
|
|
967
905
|
/**
|
|
968
906
|
* Asynchronous readdir(3) - read a directory.
|
|
@@ -971,7 +909,7 @@ declare module 'fs' {
|
|
|
971
909
|
*/
|
|
972
910
|
function readdir(
|
|
973
911
|
path: PathLike,
|
|
974
|
-
options: { encoding: BufferEncoding | null; withFileTypes?: false
|
|
912
|
+
options: { encoding: BufferEncoding | null; withFileTypes?: false } | BufferEncoding | undefined | null,
|
|
975
913
|
callback: (err: NodeJS.ErrnoException | null, files: string[]) => void,
|
|
976
914
|
): void;
|
|
977
915
|
|
|
@@ -980,7 +918,7 @@ declare module 'fs' {
|
|
|
980
918
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
981
919
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
982
920
|
*/
|
|
983
|
-
function readdir(path: PathLike, options: { encoding: "buffer"; withFileTypes?: false
|
|
921
|
+
function readdir(path: PathLike, options: { encoding: "buffer"; withFileTypes?: false } | "buffer", callback: (err: NodeJS.ErrnoException | null, files: Buffer[]) => void): void;
|
|
984
922
|
|
|
985
923
|
/**
|
|
986
924
|
* Asynchronous readdir(3) - read a directory.
|
|
@@ -989,7 +927,7 @@ declare module 'fs' {
|
|
|
989
927
|
*/
|
|
990
928
|
function readdir(
|
|
991
929
|
path: PathLike,
|
|
992
|
-
options: { encoding?: string | null
|
|
930
|
+
options: { encoding?: string | null; withFileTypes?: false } | string | undefined | null,
|
|
993
931
|
callback: (err: NodeJS.ErrnoException | null, files: string[] | Buffer[]) => void,
|
|
994
932
|
): void;
|
|
995
933
|
|
|
@@ -1004,7 +942,7 @@ declare module 'fs' {
|
|
|
1004
942
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1005
943
|
* @param options If called with `withFileTypes: true` the result data will be an array of Dirent.
|
|
1006
944
|
*/
|
|
1007
|
-
function readdir(path: PathLike, options: { encoding?: string | null
|
|
945
|
+
function readdir(path: PathLike, options: { encoding?: string | null; withFileTypes: true }, callback: (err: NodeJS.ErrnoException | null, files: Dirent[]) => void): void;
|
|
1008
946
|
|
|
1009
947
|
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
|
|
1010
948
|
namespace readdir {
|
|
@@ -1013,28 +951,28 @@ declare module 'fs' {
|
|
|
1013
951
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1014
952
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1015
953
|
*/
|
|
1016
|
-
function __promisify__(path: PathLike, options?: { encoding: BufferEncoding | null; withFileTypes?: false
|
|
954
|
+
function __promisify__(path: PathLike, options?: { encoding: BufferEncoding | null; withFileTypes?: false } | BufferEncoding | null): Promise<string[]>;
|
|
1017
955
|
|
|
1018
956
|
/**
|
|
1019
957
|
* Asynchronous readdir(3) - read a directory.
|
|
1020
958
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1021
959
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1022
960
|
*/
|
|
1023
|
-
function __promisify__(path: PathLike, options: "buffer" | { encoding: "buffer"; withFileTypes?: false
|
|
961
|
+
function __promisify__(path: PathLike, options: "buffer" | { encoding: "buffer"; withFileTypes?: false }): Promise<Buffer[]>;
|
|
1024
962
|
|
|
1025
963
|
/**
|
|
1026
964
|
* Asynchronous readdir(3) - read a directory.
|
|
1027
965
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1028
966
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1029
967
|
*/
|
|
1030
|
-
function __promisify__(path: PathLike, options?: { encoding?: string | null
|
|
968
|
+
function __promisify__(path: PathLike, options?: { encoding?: string | null; withFileTypes?: false } | string | null): Promise<string[] | Buffer[]>;
|
|
1031
969
|
|
|
1032
970
|
/**
|
|
1033
971
|
* Asynchronous readdir(3) - read a directory.
|
|
1034
972
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1035
973
|
* @param options If called with `withFileTypes: true` the result data will be an array of Dirent
|
|
1036
974
|
*/
|
|
1037
|
-
function __promisify__(path: PathLike, options: { encoding?: string | null
|
|
975
|
+
function __promisify__(path: PathLike, options: { encoding?: string | null; withFileTypes: true }): Promise<Dirent[]>;
|
|
1038
976
|
}
|
|
1039
977
|
|
|
1040
978
|
/**
|
|
@@ -1042,28 +980,28 @@ declare module 'fs' {
|
|
|
1042
980
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1043
981
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1044
982
|
*/
|
|
1045
|
-
function readdirSync(path: PathLike, options?: { encoding: BufferEncoding | null; withFileTypes?: false
|
|
983
|
+
function readdirSync(path: PathLike, options?: { encoding: BufferEncoding | null; withFileTypes?: false } | BufferEncoding | null): string[];
|
|
1046
984
|
|
|
1047
985
|
/**
|
|
1048
986
|
* Synchronous readdir(3) - read a directory.
|
|
1049
987
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1050
988
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1051
989
|
*/
|
|
1052
|
-
function readdirSync(path: PathLike, options: { encoding: "buffer"; withFileTypes?: false
|
|
990
|
+
function readdirSync(path: PathLike, options: { encoding: "buffer"; withFileTypes?: false } | "buffer"): Buffer[];
|
|
1053
991
|
|
|
1054
992
|
/**
|
|
1055
993
|
* Synchronous readdir(3) - read a directory.
|
|
1056
994
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1057
995
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1058
996
|
*/
|
|
1059
|
-
function readdirSync(path: PathLike, options?: { encoding?: string | null
|
|
997
|
+
function readdirSync(path: PathLike, options?: { encoding?: string | null; withFileTypes?: false } | string | null): string[] | Buffer[];
|
|
1060
998
|
|
|
1061
999
|
/**
|
|
1062
1000
|
* Synchronous readdir(3) - read a directory.
|
|
1063
1001
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1064
1002
|
* @param options If called with `withFileTypes: true` the result data will be an array of Dirent.
|
|
1065
1003
|
*/
|
|
1066
|
-
function readdirSync(path: PathLike, options: { encoding?: string | null
|
|
1004
|
+
function readdirSync(path: PathLike, options: { encoding?: string | null; withFileTypes: true }): Dirent[];
|
|
1067
1005
|
|
|
1068
1006
|
/**
|
|
1069
1007
|
* Asynchronous close(2) - close a file descriptor.
|
|
@@ -1366,11 +1304,7 @@ declare module 'fs' {
|
|
|
1366
1304
|
* @param options An object that may contain an optional flag.
|
|
1367
1305
|
* If a flag is not provided, it defaults to `'r'`.
|
|
1368
1306
|
*/
|
|
1369
|
-
function readFile(
|
|
1370
|
-
path: PathLike | number,
|
|
1371
|
-
options: { encoding?: null | undefined; flag?: string | undefined; } | undefined | null,
|
|
1372
|
-
callback: (err: NodeJS.ErrnoException | null, data: Buffer) => void
|
|
1373
|
-
): void;
|
|
1307
|
+
function readFile(path: PathLike | number, options: { encoding?: null; flag?: string; } | undefined | null, callback: (err: NodeJS.ErrnoException | null, data: Buffer) => void): void;
|
|
1374
1308
|
|
|
1375
1309
|
/**
|
|
1376
1310
|
* Asynchronously reads the entire contents of a file.
|
|
@@ -1380,7 +1314,7 @@ declare module 'fs' {
|
|
|
1380
1314
|
* @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
|
|
1381
1315
|
* If a flag is not provided, it defaults to `'r'`.
|
|
1382
1316
|
*/
|
|
1383
|
-
function readFile(path: PathLike | number, options: { encoding: string; flag?: string
|
|
1317
|
+
function readFile(path: PathLike | number, options: { encoding: string; flag?: string; } | string, callback: (err: NodeJS.ErrnoException | null, data: string) => void): void;
|
|
1384
1318
|
|
|
1385
1319
|
/**
|
|
1386
1320
|
* Asynchronously reads the entire contents of a file.
|
|
@@ -1392,7 +1326,7 @@ declare module 'fs' {
|
|
|
1392
1326
|
*/
|
|
1393
1327
|
function readFile(
|
|
1394
1328
|
path: PathLike | number,
|
|
1395
|
-
options: { encoding?: string | null
|
|
1329
|
+
options: { encoding?: string | null; flag?: string; } | string | undefined | null,
|
|
1396
1330
|
callback: (err: NodeJS.ErrnoException | null, data: string | Buffer) => void,
|
|
1397
1331
|
): void;
|
|
1398
1332
|
|
|
@@ -1412,7 +1346,7 @@ declare module 'fs' {
|
|
|
1412
1346
|
* @param options An object that may contain an optional flag.
|
|
1413
1347
|
* If a flag is not provided, it defaults to `'r'`.
|
|
1414
1348
|
*/
|
|
1415
|
-
function __promisify__(path: PathLike | number, options?: { encoding?: null
|
|
1349
|
+
function __promisify__(path: PathLike | number, options?: { encoding?: null; flag?: string; } | null): Promise<Buffer>;
|
|
1416
1350
|
|
|
1417
1351
|
/**
|
|
1418
1352
|
* Asynchronously reads the entire contents of a file.
|
|
@@ -1422,7 +1356,7 @@ declare module 'fs' {
|
|
|
1422
1356
|
* @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
|
|
1423
1357
|
* If a flag is not provided, it defaults to `'r'`.
|
|
1424
1358
|
*/
|
|
1425
|
-
function __promisify__(path: PathLike | number, options: { encoding: string; flag?: string
|
|
1359
|
+
function __promisify__(path: PathLike | number, options: { encoding: string; flag?: string; } | string): Promise<string>;
|
|
1426
1360
|
|
|
1427
1361
|
/**
|
|
1428
1362
|
* Asynchronously reads the entire contents of a file.
|
|
@@ -1432,7 +1366,7 @@ declare module 'fs' {
|
|
|
1432
1366
|
* @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
|
|
1433
1367
|
* If a flag is not provided, it defaults to `'r'`.
|
|
1434
1368
|
*/
|
|
1435
|
-
function __promisify__(path: PathLike | number, options?: { encoding?: string | null
|
|
1369
|
+
function __promisify__(path: PathLike | number, options?: { encoding?: string | null; flag?: string; } | string | null): Promise<string | Buffer>;
|
|
1436
1370
|
}
|
|
1437
1371
|
|
|
1438
1372
|
/**
|
|
@@ -1442,7 +1376,7 @@ declare module 'fs' {
|
|
|
1442
1376
|
* If a file descriptor is provided, the underlying file will _not_ be closed automatically.
|
|
1443
1377
|
* @param options An object that may contain an optional flag. If a flag is not provided, it defaults to `'r'`.
|
|
1444
1378
|
*/
|
|
1445
|
-
function readFileSync(path: PathLike | number, options?: { encoding?: null
|
|
1379
|
+
function readFileSync(path: PathLike | number, options?: { encoding?: null; flag?: string; } | null): Buffer;
|
|
1446
1380
|
|
|
1447
1381
|
/**
|
|
1448
1382
|
* Synchronously reads the entire contents of a file.
|
|
@@ -1452,7 +1386,7 @@ declare module 'fs' {
|
|
|
1452
1386
|
* @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
|
|
1453
1387
|
* If a flag is not provided, it defaults to `'r'`.
|
|
1454
1388
|
*/
|
|
1455
|
-
function readFileSync(path: PathLike | number, options: { encoding: string; flag?: string
|
|
1389
|
+
function readFileSync(path: PathLike | number, options: { encoding: string; flag?: string; } | string): string;
|
|
1456
1390
|
|
|
1457
1391
|
/**
|
|
1458
1392
|
* Synchronously reads the entire contents of a file.
|
|
@@ -1462,9 +1396,9 @@ declare module 'fs' {
|
|
|
1462
1396
|
* @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
|
|
1463
1397
|
* If a flag is not provided, it defaults to `'r'`.
|
|
1464
1398
|
*/
|
|
1465
|
-
function readFileSync(path: PathLike | number, options?: { encoding?: string | null
|
|
1399
|
+
function readFileSync(path: PathLike | number, options?: { encoding?: string | null; flag?: string; } | string | null): string | Buffer;
|
|
1466
1400
|
|
|
1467
|
-
type WriteFileOptions = { encoding?: string | null
|
|
1401
|
+
type WriteFileOptions = { encoding?: string | null; mode?: number | string; flag?: string; } | string | null;
|
|
1468
1402
|
|
|
1469
1403
|
/**
|
|
1470
1404
|
* Asynchronously writes data to a file, replacing the file if it already exists.
|
|
@@ -1577,7 +1511,7 @@ declare module 'fs' {
|
|
|
1577
1511
|
/**
|
|
1578
1512
|
* Watch for changes on `filename`. The callback `listener` will be called each time the file is accessed.
|
|
1579
1513
|
*/
|
|
1580
|
-
function watchFile(filename: PathLike, options: { persistent?: boolean
|
|
1514
|
+
function watchFile(filename: PathLike, options: { persistent?: boolean; interval?: number; } | undefined, listener: (curr: Stats, prev: Stats) => void): void;
|
|
1581
1515
|
|
|
1582
1516
|
/**
|
|
1583
1517
|
* Watch for changes on `filename`. The callback `listener` will be called each time the file is accessed.
|
|
@@ -1604,7 +1538,7 @@ declare module 'fs' {
|
|
|
1604
1538
|
*/
|
|
1605
1539
|
function watch(
|
|
1606
1540
|
filename: PathLike,
|
|
1607
|
-
options: { encoding?: BufferEncoding | null
|
|
1541
|
+
options: { encoding?: BufferEncoding | null, persistent?: boolean, recursive?: boolean } | BufferEncoding | undefined | null,
|
|
1608
1542
|
listener?: (event: string, filename: string) => void,
|
|
1609
1543
|
): FSWatcher;
|
|
1610
1544
|
|
|
@@ -1617,11 +1551,7 @@ declare module 'fs' {
|
|
|
1617
1551
|
* If `persistent` is not supplied, the default of `true` is used.
|
|
1618
1552
|
* If `recursive` is not supplied, the default of `false` is used.
|
|
1619
1553
|
*/
|
|
1620
|
-
function watch(
|
|
1621
|
-
filename: PathLike,
|
|
1622
|
-
options: { encoding: "buffer", persistent?: boolean | undefined, recursive?: boolean | undefined } | "buffer",
|
|
1623
|
-
listener?: (event: string, filename: Buffer) => void
|
|
1624
|
-
): FSWatcher;
|
|
1554
|
+
function watch(filename: PathLike, options: { encoding: "buffer", persistent?: boolean, recursive?: boolean } | "buffer", listener?: (event: string, filename: Buffer) => void): FSWatcher;
|
|
1625
1555
|
|
|
1626
1556
|
/**
|
|
1627
1557
|
* Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`.
|
|
@@ -1634,7 +1564,7 @@ declare module 'fs' {
|
|
|
1634
1564
|
*/
|
|
1635
1565
|
function watch(
|
|
1636
1566
|
filename: PathLike,
|
|
1637
|
-
options: { encoding?: string | null
|
|
1567
|
+
options: { encoding?: string | null, persistent?: boolean, recursive?: boolean } | string | null,
|
|
1638
1568
|
listener?: (event: string, filename: string | Buffer) => void,
|
|
1639
1569
|
): FSWatcher;
|
|
1640
1570
|
|
|
@@ -1869,18 +1799,18 @@ declare module 'fs' {
|
|
|
1869
1799
|
* URL support is _experimental_.
|
|
1870
1800
|
*/
|
|
1871
1801
|
function createReadStream(path: PathLike, options?: string | {
|
|
1872
|
-
flags?: string
|
|
1873
|
-
encoding?: string
|
|
1874
|
-
fd?: number
|
|
1875
|
-
mode?: number
|
|
1876
|
-
autoClose?: boolean
|
|
1802
|
+
flags?: string;
|
|
1803
|
+
encoding?: string;
|
|
1804
|
+
fd?: number;
|
|
1805
|
+
mode?: number;
|
|
1806
|
+
autoClose?: boolean;
|
|
1877
1807
|
/**
|
|
1878
1808
|
* @default false
|
|
1879
1809
|
*/
|
|
1880
|
-
emitClose?: boolean
|
|
1881
|
-
start?: number
|
|
1882
|
-
end?: number
|
|
1883
|
-
highWaterMark?: number
|
|
1810
|
+
emitClose?: boolean;
|
|
1811
|
+
start?: number;
|
|
1812
|
+
end?: number;
|
|
1813
|
+
highWaterMark?: number;
|
|
1884
1814
|
}): ReadStream;
|
|
1885
1815
|
|
|
1886
1816
|
/**
|
|
@@ -1889,14 +1819,13 @@ declare module 'fs' {
|
|
|
1889
1819
|
* URL support is _experimental_.
|
|
1890
1820
|
*/
|
|
1891
1821
|
function createWriteStream(path: PathLike, options?: string | {
|
|
1892
|
-
flags?: string
|
|
1893
|
-
encoding?: string
|
|
1894
|
-
fd?: number
|
|
1895
|
-
mode?: number
|
|
1896
|
-
autoClose?: boolean
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
highWaterMark?: number | undefined;
|
|
1822
|
+
flags?: string;
|
|
1823
|
+
encoding?: string;
|
|
1824
|
+
fd?: number;
|
|
1825
|
+
mode?: number;
|
|
1826
|
+
autoClose?: boolean;
|
|
1827
|
+
start?: number;
|
|
1828
|
+
highWaterMark?: number;
|
|
1900
1829
|
}): WriteStream;
|
|
1901
1830
|
|
|
1902
1831
|
/**
|
|
@@ -1980,12 +1909,12 @@ declare module 'fs' {
|
|
|
1980
1909
|
*/
|
|
1981
1910
|
function writev(
|
|
1982
1911
|
fd: number,
|
|
1983
|
-
buffers:
|
|
1912
|
+
buffers: NodeJS.ArrayBufferView[],
|
|
1984
1913
|
cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers: NodeJS.ArrayBufferView[]) => void
|
|
1985
1914
|
): void;
|
|
1986
1915
|
function writev(
|
|
1987
1916
|
fd: number,
|
|
1988
|
-
buffers:
|
|
1917
|
+
buffers: NodeJS.ArrayBufferView[],
|
|
1989
1918
|
position: number,
|
|
1990
1919
|
cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers: NodeJS.ArrayBufferView[]) => void
|
|
1991
1920
|
): void;
|
|
@@ -1996,25 +1925,32 @@ declare module 'fs' {
|
|
|
1996
1925
|
}
|
|
1997
1926
|
|
|
1998
1927
|
namespace writev {
|
|
1999
|
-
function __promisify__(fd: number, buffers:
|
|
1928
|
+
function __promisify__(fd: number, buffers: NodeJS.ArrayBufferView[], position?: number): Promise<WriteVResult>;
|
|
2000
1929
|
}
|
|
2001
1930
|
|
|
2002
1931
|
/**
|
|
2003
1932
|
* See `writev`.
|
|
2004
1933
|
*/
|
|
2005
|
-
function writevSync(fd: number, buffers:
|
|
1934
|
+
function writevSync(fd: number, buffers: NodeJS.ArrayBufferView[], position?: number): number;
|
|
2006
1935
|
|
|
2007
1936
|
interface OpenDirOptions {
|
|
2008
|
-
encoding?: BufferEncoding
|
|
1937
|
+
encoding?: BufferEncoding;
|
|
1938
|
+
/**
|
|
1939
|
+
* Number of directory entries that are buffered
|
|
1940
|
+
* internally when reading from the directory. Higher values lead to better
|
|
1941
|
+
* performance but higher memory usage.
|
|
1942
|
+
* @default 32
|
|
1943
|
+
*/
|
|
1944
|
+
bufferSize?: number;
|
|
2009
1945
|
}
|
|
2010
1946
|
|
|
2011
|
-
function opendirSync(path:
|
|
1947
|
+
function opendirSync(path: string, options?: OpenDirOptions): Dir;
|
|
2012
1948
|
|
|
2013
|
-
function opendir(path:
|
|
2014
|
-
function opendir(path:
|
|
1949
|
+
function opendir(path: string, cb: (err: NodeJS.ErrnoException | null, dir: Dir) => void): void;
|
|
1950
|
+
function opendir(path: string, options: OpenDirOptions, cb: (err: NodeJS.ErrnoException | null, dir: Dir) => void): void;
|
|
2015
1951
|
|
|
2016
1952
|
namespace opendir {
|
|
2017
|
-
function __promisify__(path:
|
|
1953
|
+
function __promisify__(path: string, options?: OpenDirOptions): Promise<Dir>;
|
|
2018
1954
|
}
|
|
2019
1955
|
|
|
2020
1956
|
namespace promises {
|
|
@@ -2034,7 +1970,7 @@ declare module 'fs' {
|
|
|
2034
1970
|
* If `mode` is a string, it is parsed as an octal integer.
|
|
2035
1971
|
* If `flag` is not supplied, the default of `'a'` is used.
|
|
2036
1972
|
*/
|
|
2037
|
-
appendFile(data: any, options?: { encoding?: string | null
|
|
1973
|
+
appendFile(data: any, options?: { encoding?: string | null, mode?: string | number, flag?: string | number } | string | null): Promise<void>;
|
|
2038
1974
|
|
|
2039
1975
|
/**
|
|
2040
1976
|
* Asynchronous fchown(2) - Change ownership of a file.
|
|
@@ -2073,7 +2009,7 @@ declare module 'fs' {
|
|
|
2073
2009
|
* @param options An object that may contain an optional flag.
|
|
2074
2010
|
* If a flag is not provided, it defaults to `'r'`.
|
|
2075
2011
|
*/
|
|
2076
|
-
readFile(options?: { encoding?: null
|
|
2012
|
+
readFile(options?: { encoding?: null, flag?: string | number } | null): Promise<Buffer>;
|
|
2077
2013
|
|
|
2078
2014
|
/**
|
|
2079
2015
|
* Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically.
|
|
@@ -2081,7 +2017,7 @@ declare module 'fs' {
|
|
|
2081
2017
|
* @param options An object that may contain an optional flag.
|
|
2082
2018
|
* If a flag is not provided, it defaults to `'r'`.
|
|
2083
2019
|
*/
|
|
2084
|
-
readFile(options: { encoding: BufferEncoding, flag?: string | number
|
|
2020
|
+
readFile(options: { encoding: BufferEncoding, flag?: string | number } | BufferEncoding): Promise<string>;
|
|
2085
2021
|
|
|
2086
2022
|
/**
|
|
2087
2023
|
* Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically.
|
|
@@ -2089,14 +2025,12 @@ declare module 'fs' {
|
|
|
2089
2025
|
* @param options An object that may contain an optional flag.
|
|
2090
2026
|
* If a flag is not provided, it defaults to `'r'`.
|
|
2091
2027
|
*/
|
|
2092
|
-
readFile(options?: { encoding?: string | null
|
|
2028
|
+
readFile(options?: { encoding?: string | null, flag?: string | number } | string | null): Promise<string | Buffer>;
|
|
2093
2029
|
|
|
2094
2030
|
/**
|
|
2095
2031
|
* Asynchronous fstat(2) - Get file status.
|
|
2096
2032
|
*/
|
|
2097
|
-
stat(
|
|
2098
|
-
stat(opts: StatOptions & { bigint: true }): Promise<BigIntStats>;
|
|
2099
|
-
stat(opts: StatOptions): Promise<Stats | BigIntStats>;
|
|
2033
|
+
stat(): Promise<Stats>;
|
|
2100
2034
|
|
|
2101
2035
|
/**
|
|
2102
2036
|
* Asynchronous ftruncate(2) - Truncate a file to a specified length.
|
|
@@ -2143,12 +2077,12 @@ declare module 'fs' {
|
|
|
2143
2077
|
* If `mode` is a string, it is parsed as an octal integer.
|
|
2144
2078
|
* If `flag` is not supplied, the default of `'w'` is used.
|
|
2145
2079
|
*/
|
|
2146
|
-
writeFile(data: any, options?: { encoding?: string | null
|
|
2080
|
+
writeFile(data: any, options?: { encoding?: string | null, mode?: string | number, flag?: string | number } | string | null): Promise<void>;
|
|
2147
2081
|
|
|
2148
2082
|
/**
|
|
2149
2083
|
* See `fs.writev` promisified version.
|
|
2150
2084
|
*/
|
|
2151
|
-
writev(buffers:
|
|
2085
|
+
writev(buffers: NodeJS.ArrayBufferView[], position?: number): Promise<WriteVResult>;
|
|
2152
2086
|
|
|
2153
2087
|
/**
|
|
2154
2088
|
* Asynchronous close(2) - close a `FileHandle`.
|
|
@@ -2255,7 +2189,7 @@ declare module 'fs' {
|
|
|
2255
2189
|
* Asynchronous rmdir(2) - delete a directory.
|
|
2256
2190
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
2257
2191
|
*/
|
|
2258
|
-
function rmdir(path: PathLike, options?:
|
|
2192
|
+
function rmdir(path: PathLike, options?: RmDirAsyncOptions): Promise<void>;
|
|
2259
2193
|
|
|
2260
2194
|
/**
|
|
2261
2195
|
* Asynchronous fdatasync(2) - synchronize a file's in-core state with storage device.
|
|
@@ -2282,35 +2216,35 @@ declare module 'fs' {
|
|
|
2282
2216
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
2283
2217
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
2284
2218
|
*/
|
|
2285
|
-
function readdir(path: PathLike, options?: { encoding?: BufferEncoding | null
|
|
2219
|
+
function readdir(path: PathLike, options?: { encoding?: BufferEncoding | null; withFileTypes?: false } | BufferEncoding | null): Promise<string[]>;
|
|
2286
2220
|
|
|
2287
2221
|
/**
|
|
2288
2222
|
* Asynchronous readdir(3) - read a directory.
|
|
2289
2223
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
2290
2224
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
2291
2225
|
*/
|
|
2292
|
-
function readdir(path: PathLike, options: { encoding: "buffer"; withFileTypes?: false
|
|
2226
|
+
function readdir(path: PathLike, options: { encoding: "buffer"; withFileTypes?: false } | "buffer"): Promise<Buffer[]>;
|
|
2293
2227
|
|
|
2294
2228
|
/**
|
|
2295
2229
|
* Asynchronous readdir(3) - read a directory.
|
|
2296
2230
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
2297
2231
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
2298
2232
|
*/
|
|
2299
|
-
function readdir(path: PathLike, options?: { encoding?: string | null
|
|
2233
|
+
function readdir(path: PathLike, options?: { encoding?: string | null; withFileTypes?: false } | string | null): Promise<string[] | Buffer[]>;
|
|
2300
2234
|
|
|
2301
2235
|
/**
|
|
2302
2236
|
* Asynchronous readdir(3) - read a directory.
|
|
2303
2237
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
2304
2238
|
* @param options If called with `withFileTypes: true` the result data will be an array of Dirent.
|
|
2305
2239
|
*/
|
|
2306
|
-
function readdir(path: PathLike, options: { encoding?: string | null
|
|
2240
|
+
function readdir(path: PathLike, options: { encoding?: string | null; withFileTypes: true }): Promise<Dirent[]>;
|
|
2307
2241
|
|
|
2308
2242
|
/**
|
|
2309
2243
|
* Asynchronous readlink(2) - read value of a symbolic link.
|
|
2310
2244
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
2311
2245
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
2312
2246
|
*/
|
|
2313
|
-
function readlink(path: PathLike, options?: { encoding?: BufferEncoding | null
|
|
2247
|
+
function readlink(path: PathLike, options?: { encoding?: BufferEncoding | null } | BufferEncoding | null): Promise<string>;
|
|
2314
2248
|
|
|
2315
2249
|
/**
|
|
2316
2250
|
* Asynchronous readlink(2) - read value of a symbolic link.
|
|
@@ -2324,7 +2258,7 @@ declare module 'fs' {
|
|
|
2324
2258
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
2325
2259
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
2326
2260
|
*/
|
|
2327
|
-
function readlink(path: PathLike, options?: { encoding?: string | null
|
|
2261
|
+
function readlink(path: PathLike, options?: { encoding?: string | null } | string | null): Promise<string | Buffer>;
|
|
2328
2262
|
|
|
2329
2263
|
/**
|
|
2330
2264
|
* Asynchronous symlink(2) - Create a new symbolic link to an existing file.
|
|
@@ -2335,21 +2269,23 @@ declare module 'fs' {
|
|
|
2335
2269
|
*/
|
|
2336
2270
|
function symlink(target: PathLike, path: PathLike, type?: string | null): Promise<void>;
|
|
2337
2271
|
|
|
2272
|
+
/**
|
|
2273
|
+
* Asynchronous fstat(2) - Get file status.
|
|
2274
|
+
* @param handle A `FileHandle`.
|
|
2275
|
+
*/
|
|
2276
|
+
function fstat(handle: FileHandle): Promise<Stats>;
|
|
2277
|
+
|
|
2338
2278
|
/**
|
|
2339
2279
|
* Asynchronous lstat(2) - Get file status. Does not dereference symbolic links.
|
|
2340
2280
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
2341
2281
|
*/
|
|
2342
|
-
function lstat(path: PathLike
|
|
2343
|
-
function lstat(path: PathLike, opts: StatOptions & { bigint: true }): Promise<BigIntStats>;
|
|
2344
|
-
function lstat(path: PathLike, opts?: StatOptions): Promise<Stats | BigIntStats>;
|
|
2282
|
+
function lstat(path: PathLike): Promise<Stats>;
|
|
2345
2283
|
|
|
2346
2284
|
/**
|
|
2347
2285
|
* Asynchronous stat(2) - Get file status.
|
|
2348
2286
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
2349
2287
|
*/
|
|
2350
|
-
function stat(path: PathLike
|
|
2351
|
-
function stat(path: PathLike, opts: StatOptions & { bigint: true }): Promise<BigIntStats>;
|
|
2352
|
-
function stat(path: PathLike, opts?: StatOptions): Promise<Stats | BigIntStats>;
|
|
2288
|
+
function stat(path: PathLike): Promise<Stats>;
|
|
2353
2289
|
|
|
2354
2290
|
/**
|
|
2355
2291
|
* Asynchronous link(2) - Create a new link (also known as a hard link) to an existing file.
|
|
@@ -2391,16 +2327,6 @@ declare module 'fs' {
|
|
|
2391
2327
|
*/
|
|
2392
2328
|
function lchown(path: PathLike, uid: number, gid: number): Promise<void>;
|
|
2393
2329
|
|
|
2394
|
-
/**
|
|
2395
|
-
* Changes the access and modification times of a file in the same way as `fsPromises.utimes()`,
|
|
2396
|
-
* with the difference that if the path refers to a symbolic link, then the link is not
|
|
2397
|
-
* dereferenced: instead, the timestamps of the symbolic link itself are changed.
|
|
2398
|
-
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
2399
|
-
* @param atime The last access time. If a string is provided, it will be coerced to number.
|
|
2400
|
-
* @param mtime The last modified time. If a string is provided, it will be coerced to number.
|
|
2401
|
-
*/
|
|
2402
|
-
function lutimes(path: PathLike, atime: string | number | Date, mtime: string | number | Date): Promise<void>;
|
|
2403
|
-
|
|
2404
2330
|
/**
|
|
2405
2331
|
* Asynchronous fchown(2) - Change ownership of a file.
|
|
2406
2332
|
* @param handle A `FileHandle`.
|
|
@@ -2434,7 +2360,7 @@ declare module 'fs' {
|
|
|
2434
2360
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
2435
2361
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
2436
2362
|
*/
|
|
2437
|
-
function realpath(path: PathLike, options?: { encoding?: BufferEncoding | null
|
|
2363
|
+
function realpath(path: PathLike, options?: { encoding?: BufferEncoding | null } | BufferEncoding | null): Promise<string>;
|
|
2438
2364
|
|
|
2439
2365
|
/**
|
|
2440
2366
|
* Asynchronous realpath(3) - return the canonicalized absolute pathname.
|
|
@@ -2448,14 +2374,14 @@ declare module 'fs' {
|
|
|
2448
2374
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
2449
2375
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
2450
2376
|
*/
|
|
2451
|
-
function realpath(path: PathLike, options?: { encoding?: string | null
|
|
2377
|
+
function realpath(path: PathLike, options?: { encoding?: string | null } | string | null): Promise<string | Buffer>;
|
|
2452
2378
|
|
|
2453
2379
|
/**
|
|
2454
2380
|
* Asynchronously creates a unique temporary directory.
|
|
2455
2381
|
* Generates six random characters to be appended behind a required `prefix` to create a unique temporary directory.
|
|
2456
2382
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
2457
2383
|
*/
|
|
2458
|
-
function mkdtemp(prefix: string, options?: { encoding?: BufferEncoding | null
|
|
2384
|
+
function mkdtemp(prefix: string, options?: { encoding?: BufferEncoding | null } | BufferEncoding | null): Promise<string>;
|
|
2459
2385
|
|
|
2460
2386
|
/**
|
|
2461
2387
|
* Asynchronously creates a unique temporary directory.
|
|
@@ -2469,7 +2395,7 @@ declare module 'fs' {
|
|
|
2469
2395
|
* Generates six random characters to be appended behind a required `prefix` to create a unique temporary directory.
|
|
2470
2396
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
2471
2397
|
*/
|
|
2472
|
-
function mkdtemp(prefix: string, options?: { encoding?: string | null
|
|
2398
|
+
function mkdtemp(prefix: string, options?: { encoding?: string | null } | string | null): Promise<string | Buffer>;
|
|
2473
2399
|
|
|
2474
2400
|
/**
|
|
2475
2401
|
* Asynchronously writes data to a file, replacing the file if it already exists.
|
|
@@ -2484,11 +2410,7 @@ declare module 'fs' {
|
|
|
2484
2410
|
* If `mode` is a string, it is parsed as an octal integer.
|
|
2485
2411
|
* If `flag` is not supplied, the default of `'w'` is used.
|
|
2486
2412
|
*/
|
|
2487
|
-
function writeFile(
|
|
2488
|
-
path: PathLike | FileHandle,
|
|
2489
|
-
data: any,
|
|
2490
|
-
options?: { encoding?: string | null | undefined, mode?: string | number | undefined, flag?: string | number | undefined } | string | null
|
|
2491
|
-
): Promise<void>;
|
|
2413
|
+
function writeFile(path: PathLike | FileHandle, data: any, options?: { encoding?: string | null, mode?: string | number, flag?: string | number } | string | null): Promise<void>;
|
|
2492
2414
|
|
|
2493
2415
|
/**
|
|
2494
2416
|
* Asynchronously append data to a file, creating the file if it does not exist.
|
|
@@ -2502,11 +2424,7 @@ declare module 'fs' {
|
|
|
2502
2424
|
* If `mode` is a string, it is parsed as an octal integer.
|
|
2503
2425
|
* If `flag` is not supplied, the default of `'a'` is used.
|
|
2504
2426
|
*/
|
|
2505
|
-
function appendFile(
|
|
2506
|
-
path: PathLike | FileHandle,
|
|
2507
|
-
data: any,
|
|
2508
|
-
options?: { encoding?: string | null | undefined, mode?: string | number | undefined, flag?: string | number | undefined } | string | null
|
|
2509
|
-
): Promise<void>;
|
|
2427
|
+
function appendFile(path: PathLike | FileHandle, data: any, options?: { encoding?: string | null, mode?: string | number, flag?: string | number } | string | null): Promise<void>;
|
|
2510
2428
|
|
|
2511
2429
|
/**
|
|
2512
2430
|
* Asynchronously reads the entire contents of a file.
|
|
@@ -2515,7 +2433,7 @@ declare module 'fs' {
|
|
|
2515
2433
|
* @param options An object that may contain an optional flag.
|
|
2516
2434
|
* If a flag is not provided, it defaults to `'r'`.
|
|
2517
2435
|
*/
|
|
2518
|
-
function readFile(path: PathLike | FileHandle, options?: { encoding?: null
|
|
2436
|
+
function readFile(path: PathLike | FileHandle, options?: { encoding?: null, flag?: string | number } | null): Promise<Buffer>;
|
|
2519
2437
|
|
|
2520
2438
|
/**
|
|
2521
2439
|
* Asynchronously reads the entire contents of a file.
|
|
@@ -2524,7 +2442,7 @@ declare module 'fs' {
|
|
|
2524
2442
|
* @param options An object that may contain an optional flag.
|
|
2525
2443
|
* If a flag is not provided, it defaults to `'r'`.
|
|
2526
2444
|
*/
|
|
2527
|
-
function readFile(path: PathLike | FileHandle, options: { encoding: BufferEncoding, flag?: string | number
|
|
2445
|
+
function readFile(path: PathLike | FileHandle, options: { encoding: BufferEncoding, flag?: string | number } | BufferEncoding): Promise<string>;
|
|
2528
2446
|
|
|
2529
2447
|
/**
|
|
2530
2448
|
* Asynchronously reads the entire contents of a file.
|
|
@@ -2533,26 +2451,8 @@ declare module 'fs' {
|
|
|
2533
2451
|
* @param options An object that may contain an optional flag.
|
|
2534
2452
|
* If a flag is not provided, it defaults to `'r'`.
|
|
2535
2453
|
*/
|
|
2536
|
-
function readFile(path: PathLike | FileHandle, options?: { encoding?: string | null
|
|
2537
|
-
|
|
2538
|
-
function opendir(path: PathLike, options?: OpenDirOptions): Promise<Dir>;
|
|
2539
|
-
}
|
|
2540
|
-
|
|
2541
|
-
interface BigIntStats extends StatsBase<bigint> {
|
|
2542
|
-
}
|
|
2543
|
-
|
|
2544
|
-
class BigIntStats {
|
|
2545
|
-
atimeNs: bigint;
|
|
2546
|
-
mtimeNs: bigint;
|
|
2547
|
-
ctimeNs: bigint;
|
|
2548
|
-
birthtimeNs: bigint;
|
|
2549
|
-
}
|
|
2550
|
-
|
|
2551
|
-
interface BigIntOptions {
|
|
2552
|
-
bigint: true;
|
|
2553
|
-
}
|
|
2454
|
+
function readFile(path: PathLike | FileHandle, options?: { encoding?: string | null, flag?: string | number } | string | null): Promise<string | Buffer>;
|
|
2554
2455
|
|
|
2555
|
-
|
|
2556
|
-
bigint: boolean;
|
|
2456
|
+
function opendir(path: string, options?: OpenDirOptions): Promise<Dir>;
|
|
2557
2457
|
}
|
|
2558
2458
|
}
|