@types/node 12.20.15 → 12.20.16
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/README.md +1 -1
- node v12.20/assert.d.ts +3 -3
- node v12.20/async_hooks.d.ts +2 -2
- node v12.20/child_process.d.ts +63 -60
- node v12.20/cluster.d.ts +10 -10
- node v12.20/crypto.d.ts +31 -31
- node v12.20/dgram.d.ts +9 -9
- node v12.20/dns.d.ts +6 -6
- node v12.20/fs.d.ts +138 -102
- node v12.20/globals.d.ts +36 -36
- node v12.20/http.d.ts +88 -88
- node v12.20/http2.d.ts +63 -63
- node v12.20/https.d.ts +4 -4
- node v12.20/inspector.d.ts +149 -149
- node v12.20/net.d.ts +26 -26
- node v12.20/package.json +2 -2
- node v12.20/path.d.ts +5 -5
- node v12.20/perf_hooks.d.ts +3 -3
- node v12.20/querystring.d.ts +3 -3
- node v12.20/readline.d.ts +13 -13
- node v12.20/repl.d.ts +13 -13
- node v12.20/stream.d.ts +19 -19
- node v12.20/tls.d.ts +49 -49
- node v12.20/url.d.ts +16 -16
- node v12.20/util.d.ts +2 -2
- node v12.20/vm.d.ts +20 -20
- node v12.20/wasi.d.ts +4 -4
- node v12.20/worker_threads.d.ts +14 -14
- node v12.20/zlib.d.ts +16 -16
node v12.20/fs.d.ts
CHANGED
|
@@ -456,7 +456,7 @@ declare module 'fs' {
|
|
|
456
456
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
457
457
|
*/
|
|
458
458
|
function stat(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
|
|
459
|
-
function stat(path: PathLike, options: StatOptions & { bigint?: false } | undefined, 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
460
|
function stat(path: PathLike, options: StatOptions & { bigint: true }, callback: (err: NodeJS.ErrnoException | null, stats: BigIntStats) => void): void;
|
|
461
461
|
function stat(path: PathLike, options: StatOptions | undefined, callback: (err: NodeJS.ErrnoException | null, stats: Stats | BigIntStats) => void): void;
|
|
462
462
|
|
|
@@ -466,7 +466,7 @@ declare module 'fs' {
|
|
|
466
466
|
* Asynchronous stat(2) - Get file status.
|
|
467
467
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
468
468
|
*/
|
|
469
|
-
function __promisify__(path: PathLike, options?: StatOptions & { bigint?: false }): Promise<Stats>;
|
|
469
|
+
function __promisify__(path: PathLike, options?: StatOptions & { bigint?: false | undefined }): Promise<Stats>;
|
|
470
470
|
function __promisify__(path: PathLike, options: StatOptions & { bigint: true }): Promise<BigIntStats>;
|
|
471
471
|
function __promisify__(path: PathLike, options?: StatOptions): Promise<Stats | BigIntStats>;
|
|
472
472
|
}
|
|
@@ -475,7 +475,7 @@ declare module 'fs' {
|
|
|
475
475
|
* Synchronous stat(2) - Get file status.
|
|
476
476
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
477
477
|
*/
|
|
478
|
-
function statSync(path: PathLike, options?: StatOptions & { bigint?: false }): Stats;
|
|
478
|
+
function statSync(path: PathLike, options?: StatOptions & { bigint?: false | undefined }): Stats;
|
|
479
479
|
function statSync(path: PathLike, options: StatOptions & { bigint: true }): BigIntStats;
|
|
480
480
|
function statSync(path: PathLike, options?: StatOptions): Stats | BigIntStats;
|
|
481
481
|
|
|
@@ -485,7 +485,7 @@ declare module 'fs' {
|
|
|
485
485
|
* Asynchronous fstat(2) - Get file status.
|
|
486
486
|
* @param fd A file descriptor.
|
|
487
487
|
*/
|
|
488
|
-
function __promisify__(fd: number, options?: StatOptions & { bigint?: false }): Promise<Stats>;
|
|
488
|
+
function __promisify__(fd: number, options?: StatOptions & { bigint?: false | undefined }): Promise<Stats>;
|
|
489
489
|
function __promisify__(fd: number, options: StatOptions & { bigint: true }): Promise<BigIntStats>;
|
|
490
490
|
function __promisify__(fd: number, options?: StatOptions): Promise<Stats | BigIntStats>;
|
|
491
491
|
}
|
|
@@ -494,7 +494,7 @@ declare module 'fs' {
|
|
|
494
494
|
* Synchronous fstat(2) - Get file status.
|
|
495
495
|
* @param fd A file descriptor.
|
|
496
496
|
*/
|
|
497
|
-
function fstatSync(fd: number, options?: StatOptions & { bigint?: false }): Stats;
|
|
497
|
+
function fstatSync(fd: number, options?: StatOptions & { bigint?: false | undefined }): Stats;
|
|
498
498
|
function fstatSync(fd: number, options: StatOptions & { bigint: true }): BigIntStats;
|
|
499
499
|
function fstatSync(fd: number, options?: StatOptions): Stats | BigIntStats;
|
|
500
500
|
|
|
@@ -503,7 +503,7 @@ declare module 'fs' {
|
|
|
503
503
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
504
504
|
*/
|
|
505
505
|
function lstat(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
|
|
506
|
-
function lstat(path: PathLike, options: StatOptions & { bigint?: false } | undefined, 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
507
|
function lstat(path: PathLike, options: StatOptions & { bigint: true }, callback: (err: NodeJS.ErrnoException | null, stats: BigIntStats) => void): void;
|
|
508
508
|
function lstat(path: PathLike, options: StatOptions | undefined, callback: (err: NodeJS.ErrnoException | null, stats: Stats | BigIntStats) => void): void;
|
|
509
509
|
|
|
@@ -513,7 +513,7 @@ declare module 'fs' {
|
|
|
513
513
|
* Asynchronous lstat(2) - Get file status. Does not dereference symbolic links.
|
|
514
514
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
515
515
|
*/
|
|
516
|
-
function __promisify__(path: PathLike, options?: StatOptions & { bigint?: false }): Promise<Stats>;
|
|
516
|
+
function __promisify__(path: PathLike, options?: StatOptions & { bigint?: false | undefined }): Promise<Stats>;
|
|
517
517
|
function __promisify__(path: PathLike, options: StatOptions & { bigint: true }): Promise<BigIntStats>;
|
|
518
518
|
function __promisify__(path: PathLike, options?: StatOptions): Promise<Stats | BigIntStats>;
|
|
519
519
|
}
|
|
@@ -522,7 +522,7 @@ declare module 'fs' {
|
|
|
522
522
|
* Synchronous lstat(2) - Get file status. Does not dereference symbolic links.
|
|
523
523
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
524
524
|
*/
|
|
525
|
-
function lstatSync(path: PathLike, options?: StatOptions & { bigint?: false }): Stats;
|
|
525
|
+
function lstatSync(path: PathLike, options?: StatOptions & { bigint?: false | undefined }): Stats;
|
|
526
526
|
function lstatSync(path: PathLike, options: StatOptions & { bigint: true }): BigIntStats;
|
|
527
527
|
function lstatSync(path: PathLike, options?: StatOptions): Stats | BigIntStats;
|
|
528
528
|
|
|
@@ -596,7 +596,7 @@ declare module 'fs' {
|
|
|
596
596
|
*/
|
|
597
597
|
function readlink(
|
|
598
598
|
path: PathLike,
|
|
599
|
-
options: { encoding?: BufferEncoding | null } | BufferEncoding | undefined | null,
|
|
599
|
+
options: { encoding?: BufferEncoding | null | undefined } | BufferEncoding | undefined | null,
|
|
600
600
|
callback: (err: NodeJS.ErrnoException | null, linkString: string) => void
|
|
601
601
|
): void;
|
|
602
602
|
|
|
@@ -612,7 +612,11 @@ declare module 'fs' {
|
|
|
612
612
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
613
613
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
614
614
|
*/
|
|
615
|
-
function readlink(
|
|
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;
|
|
616
620
|
|
|
617
621
|
/**
|
|
618
622
|
* Asynchronous readlink(2) - read value of a symbolic link.
|
|
@@ -627,7 +631,7 @@ declare module 'fs' {
|
|
|
627
631
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
628
632
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
629
633
|
*/
|
|
630
|
-
function __promisify__(path: PathLike, options?: { encoding?: BufferEncoding | null } | BufferEncoding | null): Promise<string>;
|
|
634
|
+
function __promisify__(path: PathLike, options?: { encoding?: BufferEncoding | null | undefined } | BufferEncoding | null): Promise<string>;
|
|
631
635
|
|
|
632
636
|
/**
|
|
633
637
|
* Asynchronous readlink(2) - read value of a symbolic link.
|
|
@@ -641,7 +645,7 @@ declare module 'fs' {
|
|
|
641
645
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
642
646
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
643
647
|
*/
|
|
644
|
-
function __promisify__(path: PathLike, options?: { encoding?: string | null } | string | null): Promise<string | Buffer>;
|
|
648
|
+
function __promisify__(path: PathLike, options?: { encoding?: string | null | undefined } | string | null): Promise<string | Buffer>;
|
|
645
649
|
}
|
|
646
650
|
|
|
647
651
|
/**
|
|
@@ -649,7 +653,7 @@ declare module 'fs' {
|
|
|
649
653
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
650
654
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
651
655
|
*/
|
|
652
|
-
function readlinkSync(path: PathLike, options?: { encoding?: BufferEncoding | null } | BufferEncoding | null): string;
|
|
656
|
+
function readlinkSync(path: PathLike, options?: { encoding?: BufferEncoding | null | undefined } | BufferEncoding | null): string;
|
|
653
657
|
|
|
654
658
|
/**
|
|
655
659
|
* Synchronous readlink(2) - read value of a symbolic link.
|
|
@@ -663,7 +667,7 @@ declare module 'fs' {
|
|
|
663
667
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
664
668
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
665
669
|
*/
|
|
666
|
-
function readlinkSync(path: PathLike, options?: { encoding?: string | null } | string | null): string | Buffer;
|
|
670
|
+
function readlinkSync(path: PathLike, options?: { encoding?: string | null | undefined } | string | null): string | Buffer;
|
|
667
671
|
|
|
668
672
|
/**
|
|
669
673
|
* Asynchronous realpath(3) - return the canonicalized absolute pathname.
|
|
@@ -672,7 +676,7 @@ declare module 'fs' {
|
|
|
672
676
|
*/
|
|
673
677
|
function realpath(
|
|
674
678
|
path: PathLike,
|
|
675
|
-
options: { encoding?: BufferEncoding | null } | BufferEncoding | undefined | null,
|
|
679
|
+
options: { encoding?: BufferEncoding | null | undefined } | BufferEncoding | undefined | null,
|
|
676
680
|
callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void
|
|
677
681
|
): void;
|
|
678
682
|
|
|
@@ -688,7 +692,11 @@ declare module 'fs' {
|
|
|
688
692
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
689
693
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
690
694
|
*/
|
|
691
|
-
function realpath(
|
|
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;
|
|
692
700
|
|
|
693
701
|
/**
|
|
694
702
|
* Asynchronous realpath(3) - return the canonicalized absolute pathname.
|
|
@@ -703,7 +711,7 @@ declare module 'fs' {
|
|
|
703
711
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
704
712
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
705
713
|
*/
|
|
706
|
-
function __promisify__(path: PathLike, options?: { encoding?: BufferEncoding | null } | BufferEncoding | null): Promise<string>;
|
|
714
|
+
function __promisify__(path: PathLike, options?: { encoding?: BufferEncoding | null | undefined } | BufferEncoding | null): Promise<string>;
|
|
707
715
|
|
|
708
716
|
/**
|
|
709
717
|
* Asynchronous realpath(3) - return the canonicalized absolute pathname.
|
|
@@ -717,15 +725,19 @@ declare module 'fs' {
|
|
|
717
725
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
718
726
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
719
727
|
*/
|
|
720
|
-
function __promisify__(path: PathLike, options?: { encoding?: string | null } | string | null): Promise<string | Buffer>;
|
|
728
|
+
function __promisify__(path: PathLike, options?: { encoding?: string | null | undefined } | string | null): Promise<string | Buffer>;
|
|
721
729
|
|
|
722
730
|
function native(
|
|
723
731
|
path: PathLike,
|
|
724
|
-
options: { encoding?: BufferEncoding | null } | BufferEncoding | undefined | null,
|
|
732
|
+
options: { encoding?: BufferEncoding | null | undefined } | BufferEncoding | undefined | null,
|
|
725
733
|
callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void
|
|
726
734
|
): void;
|
|
727
735
|
function native(path: PathLike, options: { encoding: "buffer" } | "buffer", callback: (err: NodeJS.ErrnoException | null, resolvedPath: Buffer) => void): void;
|
|
728
|
-
function native(
|
|
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;
|
|
729
741
|
function native(path: PathLike, callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void): void;
|
|
730
742
|
}
|
|
731
743
|
|
|
@@ -734,7 +746,7 @@ declare module 'fs' {
|
|
|
734
746
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
735
747
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
736
748
|
*/
|
|
737
|
-
function realpathSync(path: PathLike, options?: { encoding?: BufferEncoding | null } | BufferEncoding | null): string;
|
|
749
|
+
function realpathSync(path: PathLike, options?: { encoding?: BufferEncoding | null | undefined } | BufferEncoding | null): string;
|
|
738
750
|
|
|
739
751
|
/**
|
|
740
752
|
* Synchronous realpath(3) - return the canonicalized absolute pathname.
|
|
@@ -748,12 +760,12 @@ declare module 'fs' {
|
|
|
748
760
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
749
761
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
750
762
|
*/
|
|
751
|
-
function realpathSync(path: PathLike, options?: { encoding?: string | null } | string | null): string | Buffer;
|
|
763
|
+
function realpathSync(path: PathLike, options?: { encoding?: string | null | undefined } | string | null): string | Buffer;
|
|
752
764
|
|
|
753
765
|
namespace realpathSync {
|
|
754
|
-
function native(path: PathLike, options?: { encoding?: BufferEncoding | null } | BufferEncoding | null): string;
|
|
766
|
+
function native(path: PathLike, options?: { encoding?: BufferEncoding | null | undefined } | BufferEncoding | null): string;
|
|
755
767
|
function native(path: PathLike, options: { encoding: "buffer" } | "buffer"): Buffer;
|
|
756
|
-
function native(path: PathLike, options?: { encoding?: string | null } | string | null): string | Buffer;
|
|
768
|
+
function native(path: PathLike, options?: { encoding?: string | null | undefined } | string | null): string | Buffer;
|
|
757
769
|
}
|
|
758
770
|
|
|
759
771
|
/**
|
|
@@ -785,7 +797,7 @@ declare module 'fs' {
|
|
|
785
797
|
* option is ignored if the `recursive` option is not `true`.
|
|
786
798
|
* @default 3
|
|
787
799
|
*/
|
|
788
|
-
maxRetries?: number;
|
|
800
|
+
maxRetries?: number | undefined;
|
|
789
801
|
/**
|
|
790
802
|
* If `true`, perform a recursive directory removal. In
|
|
791
803
|
* recursive mode, errors are not reported if `path` does not exist, and
|
|
@@ -793,7 +805,7 @@ declare module 'fs' {
|
|
|
793
805
|
* @experimental
|
|
794
806
|
* @default false
|
|
795
807
|
*/
|
|
796
|
-
recursive?: boolean;
|
|
808
|
+
recursive?: boolean | undefined;
|
|
797
809
|
/**
|
|
798
810
|
* If an `EMFILE` error is encountered, Node.js will
|
|
799
811
|
* retry the operation with a linear backoff of 1ms longer on each try until the
|
|
@@ -801,7 +813,7 @@ declare module 'fs' {
|
|
|
801
813
|
* option is not `true`.
|
|
802
814
|
* @default 1000
|
|
803
815
|
*/
|
|
804
|
-
emfileWait?: number;
|
|
816
|
+
emfileWait?: number | undefined;
|
|
805
817
|
}
|
|
806
818
|
|
|
807
819
|
/**
|
|
@@ -831,12 +843,12 @@ declare module 'fs' {
|
|
|
831
843
|
* Indicates whether parent folders should be created.
|
|
832
844
|
* @default false
|
|
833
845
|
*/
|
|
834
|
-
recursive?: boolean;
|
|
846
|
+
recursive?: boolean | undefined;
|
|
835
847
|
/**
|
|
836
848
|
* A file mode. If a string is passed, it is parsed as an octal integer. If not specified
|
|
837
849
|
* @default 0o777.
|
|
838
850
|
*/
|
|
839
|
-
mode?: number | string;
|
|
851
|
+
mode?: number | string | undefined;
|
|
840
852
|
}
|
|
841
853
|
|
|
842
854
|
/**
|
|
@@ -877,7 +889,11 @@ declare module 'fs' {
|
|
|
877
889
|
* Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
|
|
878
890
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
879
891
|
*/
|
|
880
|
-
function mkdtemp(
|
|
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;
|
|
881
897
|
|
|
882
898
|
/**
|
|
883
899
|
* Asynchronously creates a unique temporary directory.
|
|
@@ -891,7 +907,11 @@ declare module 'fs' {
|
|
|
891
907
|
* Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
|
|
892
908
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
893
909
|
*/
|
|
894
|
-
function mkdtemp(
|
|
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;
|
|
895
915
|
|
|
896
916
|
/**
|
|
897
917
|
* Asynchronously creates a unique temporary directory.
|
|
@@ -906,7 +926,7 @@ declare module 'fs' {
|
|
|
906
926
|
* Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
|
|
907
927
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
908
928
|
*/
|
|
909
|
-
function __promisify__(prefix: string, options?: { encoding?: BufferEncoding | null } | BufferEncoding | null): Promise<string>;
|
|
929
|
+
function __promisify__(prefix: string, options?: { encoding?: BufferEncoding | null | undefined } | BufferEncoding | null): Promise<string>;
|
|
910
930
|
|
|
911
931
|
/**
|
|
912
932
|
* Asynchronously creates a unique temporary directory.
|
|
@@ -920,7 +940,7 @@ declare module 'fs' {
|
|
|
920
940
|
* Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
|
|
921
941
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
922
942
|
*/
|
|
923
|
-
function __promisify__(prefix: string, options?: { encoding?: string | null } | string | null): Promise<string | Buffer>;
|
|
943
|
+
function __promisify__(prefix: string, options?: { encoding?: string | null | undefined } | string | null): Promise<string | Buffer>;
|
|
924
944
|
}
|
|
925
945
|
|
|
926
946
|
/**
|
|
@@ -928,7 +948,7 @@ declare module 'fs' {
|
|
|
928
948
|
* Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
|
|
929
949
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
930
950
|
*/
|
|
931
|
-
function mkdtempSync(prefix: string, options?: { encoding?: BufferEncoding | null } | BufferEncoding | null): string;
|
|
951
|
+
function mkdtempSync(prefix: string, options?: { encoding?: BufferEncoding | null | undefined } | BufferEncoding | null): string;
|
|
932
952
|
|
|
933
953
|
/**
|
|
934
954
|
* Synchronously creates a unique temporary directory.
|
|
@@ -942,7 +962,7 @@ declare module 'fs' {
|
|
|
942
962
|
* Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
|
|
943
963
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
944
964
|
*/
|
|
945
|
-
function mkdtempSync(prefix: string, options?: { encoding?: string | null } | string | null): string | Buffer;
|
|
965
|
+
function mkdtempSync(prefix: string, options?: { encoding?: string | null | undefined } | string | null): string | Buffer;
|
|
946
966
|
|
|
947
967
|
/**
|
|
948
968
|
* Asynchronous readdir(3) - read a directory.
|
|
@@ -951,7 +971,7 @@ declare module 'fs' {
|
|
|
951
971
|
*/
|
|
952
972
|
function readdir(
|
|
953
973
|
path: PathLike,
|
|
954
|
-
options: { encoding: BufferEncoding | null; withFileTypes?: false } | BufferEncoding | undefined | null,
|
|
974
|
+
options: { encoding: BufferEncoding | null; withFileTypes?: false | undefined } | BufferEncoding | undefined | null,
|
|
955
975
|
callback: (err: NodeJS.ErrnoException | null, files: string[]) => void,
|
|
956
976
|
): void;
|
|
957
977
|
|
|
@@ -960,7 +980,7 @@ declare module 'fs' {
|
|
|
960
980
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
961
981
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
962
982
|
*/
|
|
963
|
-
function readdir(path: PathLike, options: { encoding: "buffer"; withFileTypes?: false } | "buffer", callback: (err: NodeJS.ErrnoException | null, files: Buffer[]) => void): void;
|
|
983
|
+
function readdir(path: PathLike, options: { encoding: "buffer"; withFileTypes?: false | undefined } | "buffer", callback: (err: NodeJS.ErrnoException | null, files: Buffer[]) => void): void;
|
|
964
984
|
|
|
965
985
|
/**
|
|
966
986
|
* Asynchronous readdir(3) - read a directory.
|
|
@@ -969,7 +989,7 @@ declare module 'fs' {
|
|
|
969
989
|
*/
|
|
970
990
|
function readdir(
|
|
971
991
|
path: PathLike,
|
|
972
|
-
options: { encoding?: string | null; withFileTypes?: false } | string | undefined | null,
|
|
992
|
+
options: { encoding?: string | null | undefined; withFileTypes?: false | undefined } | string | undefined | null,
|
|
973
993
|
callback: (err: NodeJS.ErrnoException | null, files: string[] | Buffer[]) => void,
|
|
974
994
|
): void;
|
|
975
995
|
|
|
@@ -984,7 +1004,7 @@ declare module 'fs' {
|
|
|
984
1004
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
985
1005
|
* @param options If called with `withFileTypes: true` the result data will be an array of Dirent.
|
|
986
1006
|
*/
|
|
987
|
-
function readdir(path: PathLike, options: { encoding?: string | null; withFileTypes: true }, callback: (err: NodeJS.ErrnoException | null, files: Dirent[]) => void): void;
|
|
1007
|
+
function readdir(path: PathLike, options: { encoding?: string | null | undefined; withFileTypes: true }, callback: (err: NodeJS.ErrnoException | null, files: Dirent[]) => void): void;
|
|
988
1008
|
|
|
989
1009
|
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
|
|
990
1010
|
namespace readdir {
|
|
@@ -993,28 +1013,28 @@ declare module 'fs' {
|
|
|
993
1013
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
994
1014
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
995
1015
|
*/
|
|
996
|
-
function __promisify__(path: PathLike, options?: { encoding: BufferEncoding | null; withFileTypes?: false } | BufferEncoding | null): Promise<string[]>;
|
|
1016
|
+
function __promisify__(path: PathLike, options?: { encoding: BufferEncoding | null; withFileTypes?: false | undefined } | BufferEncoding | null): Promise<string[]>;
|
|
997
1017
|
|
|
998
1018
|
/**
|
|
999
1019
|
* Asynchronous readdir(3) - read a directory.
|
|
1000
1020
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1001
1021
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1002
1022
|
*/
|
|
1003
|
-
function __promisify__(path: PathLike, options: "buffer" | { encoding: "buffer"; withFileTypes?: false }): Promise<Buffer[]>;
|
|
1023
|
+
function __promisify__(path: PathLike, options: "buffer" | { encoding: "buffer"; withFileTypes?: false | undefined }): Promise<Buffer[]>;
|
|
1004
1024
|
|
|
1005
1025
|
/**
|
|
1006
1026
|
* Asynchronous readdir(3) - read a directory.
|
|
1007
1027
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1008
1028
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1009
1029
|
*/
|
|
1010
|
-
function __promisify__(path: PathLike, options?: { encoding?: string | null; withFileTypes?: false } | string | null): Promise<string[] | Buffer[]>;
|
|
1030
|
+
function __promisify__(path: PathLike, options?: { encoding?: string | null | undefined; withFileTypes?: false | undefined } | string | null): Promise<string[] | Buffer[]>;
|
|
1011
1031
|
|
|
1012
1032
|
/**
|
|
1013
1033
|
* Asynchronous readdir(3) - read a directory.
|
|
1014
1034
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1015
1035
|
* @param options If called with `withFileTypes: true` the result data will be an array of Dirent
|
|
1016
1036
|
*/
|
|
1017
|
-
function __promisify__(path: PathLike, options: { encoding?: string | null; withFileTypes: true }): Promise<Dirent[]>;
|
|
1037
|
+
function __promisify__(path: PathLike, options: { encoding?: string | null | undefined; withFileTypes: true }): Promise<Dirent[]>;
|
|
1018
1038
|
}
|
|
1019
1039
|
|
|
1020
1040
|
/**
|
|
@@ -1022,28 +1042,28 @@ declare module 'fs' {
|
|
|
1022
1042
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1023
1043
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1024
1044
|
*/
|
|
1025
|
-
function readdirSync(path: PathLike, options?: { encoding: BufferEncoding | null; withFileTypes?: false } | BufferEncoding | null): string[];
|
|
1045
|
+
function readdirSync(path: PathLike, options?: { encoding: BufferEncoding | null; withFileTypes?: false | undefined } | BufferEncoding | null): string[];
|
|
1026
1046
|
|
|
1027
1047
|
/**
|
|
1028
1048
|
* Synchronous readdir(3) - read a directory.
|
|
1029
1049
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1030
1050
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1031
1051
|
*/
|
|
1032
|
-
function readdirSync(path: PathLike, options: { encoding: "buffer"; withFileTypes?: false } | "buffer"): Buffer[];
|
|
1052
|
+
function readdirSync(path: PathLike, options: { encoding: "buffer"; withFileTypes?: false | undefined } | "buffer"): Buffer[];
|
|
1033
1053
|
|
|
1034
1054
|
/**
|
|
1035
1055
|
* Synchronous readdir(3) - read a directory.
|
|
1036
1056
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1037
1057
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1038
1058
|
*/
|
|
1039
|
-
function readdirSync(path: PathLike, options?: { encoding?: string | null; withFileTypes?: false } | string | null): string[] | Buffer[];
|
|
1059
|
+
function readdirSync(path: PathLike, options?: { encoding?: string | null | undefined; withFileTypes?: false | undefined } | string | null): string[] | Buffer[];
|
|
1040
1060
|
|
|
1041
1061
|
/**
|
|
1042
1062
|
* Synchronous readdir(3) - read a directory.
|
|
1043
1063
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1044
1064
|
* @param options If called with `withFileTypes: true` the result data will be an array of Dirent.
|
|
1045
1065
|
*/
|
|
1046
|
-
function readdirSync(path: PathLike, options: { encoding?: string | null; withFileTypes: true }): Dirent[];
|
|
1066
|
+
function readdirSync(path: PathLike, options: { encoding?: string | null | undefined; withFileTypes: true }): Dirent[];
|
|
1047
1067
|
|
|
1048
1068
|
/**
|
|
1049
1069
|
* Asynchronous close(2) - close a file descriptor.
|
|
@@ -1346,7 +1366,11 @@ declare module 'fs' {
|
|
|
1346
1366
|
* @param options An object that may contain an optional flag.
|
|
1347
1367
|
* If a flag is not provided, it defaults to `'r'`.
|
|
1348
1368
|
*/
|
|
1349
|
-
function readFile(
|
|
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;
|
|
1350
1374
|
|
|
1351
1375
|
/**
|
|
1352
1376
|
* Asynchronously reads the entire contents of a file.
|
|
@@ -1356,7 +1380,7 @@ declare module 'fs' {
|
|
|
1356
1380
|
* @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
|
|
1357
1381
|
* If a flag is not provided, it defaults to `'r'`.
|
|
1358
1382
|
*/
|
|
1359
|
-
function readFile(path: PathLike | number, options: { encoding: string; flag?: string; } | string, callback: (err: NodeJS.ErrnoException | null, data: string) => void): void;
|
|
1383
|
+
function readFile(path: PathLike | number, options: { encoding: string; flag?: string | undefined; } | string, callback: (err: NodeJS.ErrnoException | null, data: string) => void): void;
|
|
1360
1384
|
|
|
1361
1385
|
/**
|
|
1362
1386
|
* Asynchronously reads the entire contents of a file.
|
|
@@ -1368,7 +1392,7 @@ declare module 'fs' {
|
|
|
1368
1392
|
*/
|
|
1369
1393
|
function readFile(
|
|
1370
1394
|
path: PathLike | number,
|
|
1371
|
-
options: { encoding?: string | null; flag?: string; } | string | undefined | null,
|
|
1395
|
+
options: { encoding?: string | null | undefined; flag?: string | undefined; } | string | undefined | null,
|
|
1372
1396
|
callback: (err: NodeJS.ErrnoException | null, data: string | Buffer) => void,
|
|
1373
1397
|
): void;
|
|
1374
1398
|
|
|
@@ -1388,7 +1412,7 @@ declare module 'fs' {
|
|
|
1388
1412
|
* @param options An object that may contain an optional flag.
|
|
1389
1413
|
* If a flag is not provided, it defaults to `'r'`.
|
|
1390
1414
|
*/
|
|
1391
|
-
function __promisify__(path: PathLike | number, options?: { encoding?: null; flag?: string; } | null): Promise<Buffer>;
|
|
1415
|
+
function __promisify__(path: PathLike | number, options?: { encoding?: null | undefined; flag?: string | undefined; } | null): Promise<Buffer>;
|
|
1392
1416
|
|
|
1393
1417
|
/**
|
|
1394
1418
|
* Asynchronously reads the entire contents of a file.
|
|
@@ -1398,7 +1422,7 @@ declare module 'fs' {
|
|
|
1398
1422
|
* @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
|
|
1399
1423
|
* If a flag is not provided, it defaults to `'r'`.
|
|
1400
1424
|
*/
|
|
1401
|
-
function __promisify__(path: PathLike | number, options: { encoding: string; flag?: string; } | string): Promise<string>;
|
|
1425
|
+
function __promisify__(path: PathLike | number, options: { encoding: string; flag?: string | undefined; } | string): Promise<string>;
|
|
1402
1426
|
|
|
1403
1427
|
/**
|
|
1404
1428
|
* Asynchronously reads the entire contents of a file.
|
|
@@ -1408,7 +1432,7 @@ declare module 'fs' {
|
|
|
1408
1432
|
* @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
|
|
1409
1433
|
* If a flag is not provided, it defaults to `'r'`.
|
|
1410
1434
|
*/
|
|
1411
|
-
function __promisify__(path: PathLike | number, options?: { encoding?: string | null; flag?: string; } | string | null): Promise<string | Buffer>;
|
|
1435
|
+
function __promisify__(path: PathLike | number, options?: { encoding?: string | null | undefined; flag?: string | undefined; } | string | null): Promise<string | Buffer>;
|
|
1412
1436
|
}
|
|
1413
1437
|
|
|
1414
1438
|
/**
|
|
@@ -1418,7 +1442,7 @@ declare module 'fs' {
|
|
|
1418
1442
|
* If a file descriptor is provided, the underlying file will _not_ be closed automatically.
|
|
1419
1443
|
* @param options An object that may contain an optional flag. If a flag is not provided, it defaults to `'r'`.
|
|
1420
1444
|
*/
|
|
1421
|
-
function readFileSync(path: PathLike | number, options?: { encoding?: null; flag?: string; } | null): Buffer;
|
|
1445
|
+
function readFileSync(path: PathLike | number, options?: { encoding?: null | undefined; flag?: string | undefined; } | null): Buffer;
|
|
1422
1446
|
|
|
1423
1447
|
/**
|
|
1424
1448
|
* Synchronously reads the entire contents of a file.
|
|
@@ -1428,7 +1452,7 @@ declare module 'fs' {
|
|
|
1428
1452
|
* @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
|
|
1429
1453
|
* If a flag is not provided, it defaults to `'r'`.
|
|
1430
1454
|
*/
|
|
1431
|
-
function readFileSync(path: PathLike | number, options: { encoding: string; flag?: string; } | string): string;
|
|
1455
|
+
function readFileSync(path: PathLike | number, options: { encoding: string; flag?: string | undefined; } | string): string;
|
|
1432
1456
|
|
|
1433
1457
|
/**
|
|
1434
1458
|
* Synchronously reads the entire contents of a file.
|
|
@@ -1438,9 +1462,9 @@ declare module 'fs' {
|
|
|
1438
1462
|
* @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
|
|
1439
1463
|
* If a flag is not provided, it defaults to `'r'`.
|
|
1440
1464
|
*/
|
|
1441
|
-
function readFileSync(path: PathLike | number, options?: { encoding?: string | null; flag?: string; } | string | null): string | Buffer;
|
|
1465
|
+
function readFileSync(path: PathLike | number, options?: { encoding?: string | null | undefined; flag?: string | undefined; } | string | null): string | Buffer;
|
|
1442
1466
|
|
|
1443
|
-
type WriteFileOptions = { encoding?: string | null; mode?: number | string; flag?: string; } | string | null;
|
|
1467
|
+
type WriteFileOptions = { encoding?: string | null | undefined; mode?: number | string | undefined; flag?: string | undefined; } | string | null;
|
|
1444
1468
|
|
|
1445
1469
|
/**
|
|
1446
1470
|
* Asynchronously writes data to a file, replacing the file if it already exists.
|
|
@@ -1553,7 +1577,7 @@ declare module 'fs' {
|
|
|
1553
1577
|
/**
|
|
1554
1578
|
* Watch for changes on `filename`. The callback `listener` will be called each time the file is accessed.
|
|
1555
1579
|
*/
|
|
1556
|
-
function watchFile(filename: PathLike, options: { persistent?: boolean; interval?: number; } | undefined, listener: (curr: Stats, prev: Stats) => void): void;
|
|
1580
|
+
function watchFile(filename: PathLike, options: { persistent?: boolean | undefined; interval?: number | undefined; } | undefined, listener: (curr: Stats, prev: Stats) => void): void;
|
|
1557
1581
|
|
|
1558
1582
|
/**
|
|
1559
1583
|
* Watch for changes on `filename`. The callback `listener` will be called each time the file is accessed.
|
|
@@ -1580,7 +1604,7 @@ declare module 'fs' {
|
|
|
1580
1604
|
*/
|
|
1581
1605
|
function watch(
|
|
1582
1606
|
filename: PathLike,
|
|
1583
|
-
options: { encoding?: BufferEncoding | null, persistent?: boolean, recursive?: boolean } | BufferEncoding | undefined | null,
|
|
1607
|
+
options: { encoding?: BufferEncoding | null | undefined, persistent?: boolean | undefined, recursive?: boolean | undefined } | BufferEncoding | undefined | null,
|
|
1584
1608
|
listener?: (event: string, filename: string) => void,
|
|
1585
1609
|
): FSWatcher;
|
|
1586
1610
|
|
|
@@ -1593,7 +1617,11 @@ declare module 'fs' {
|
|
|
1593
1617
|
* If `persistent` is not supplied, the default of `true` is used.
|
|
1594
1618
|
* If `recursive` is not supplied, the default of `false` is used.
|
|
1595
1619
|
*/
|
|
1596
|
-
function watch(
|
|
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;
|
|
1597
1625
|
|
|
1598
1626
|
/**
|
|
1599
1627
|
* Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`.
|
|
@@ -1606,7 +1634,7 @@ declare module 'fs' {
|
|
|
1606
1634
|
*/
|
|
1607
1635
|
function watch(
|
|
1608
1636
|
filename: PathLike,
|
|
1609
|
-
options: { encoding?: string | null, persistent?: boolean, recursive?: boolean } | string | null,
|
|
1637
|
+
options: { encoding?: string | null | undefined, persistent?: boolean | undefined, recursive?: boolean | undefined } | string | null,
|
|
1610
1638
|
listener?: (event: string, filename: string | Buffer) => void,
|
|
1611
1639
|
): FSWatcher;
|
|
1612
1640
|
|
|
@@ -1841,18 +1869,18 @@ declare module 'fs' {
|
|
|
1841
1869
|
* URL support is _experimental_.
|
|
1842
1870
|
*/
|
|
1843
1871
|
function createReadStream(path: PathLike, options?: string | {
|
|
1844
|
-
flags?: string;
|
|
1845
|
-
encoding?: string;
|
|
1846
|
-
fd?: number;
|
|
1847
|
-
mode?: number;
|
|
1848
|
-
autoClose?: boolean;
|
|
1872
|
+
flags?: string | undefined;
|
|
1873
|
+
encoding?: string | undefined;
|
|
1874
|
+
fd?: number | undefined;
|
|
1875
|
+
mode?: number | undefined;
|
|
1876
|
+
autoClose?: boolean | undefined;
|
|
1849
1877
|
/**
|
|
1850
1878
|
* @default false
|
|
1851
1879
|
*/
|
|
1852
|
-
emitClose?: boolean;
|
|
1853
|
-
start?: number;
|
|
1854
|
-
end?: number;
|
|
1855
|
-
highWaterMark?: number;
|
|
1880
|
+
emitClose?: boolean | undefined;
|
|
1881
|
+
start?: number | undefined;
|
|
1882
|
+
end?: number | undefined;
|
|
1883
|
+
highWaterMark?: number | undefined;
|
|
1856
1884
|
}): ReadStream;
|
|
1857
1885
|
|
|
1858
1886
|
/**
|
|
@@ -1861,14 +1889,14 @@ declare module 'fs' {
|
|
|
1861
1889
|
* URL support is _experimental_.
|
|
1862
1890
|
*/
|
|
1863
1891
|
function createWriteStream(path: PathLike, options?: string | {
|
|
1864
|
-
flags?: string;
|
|
1865
|
-
encoding?: string;
|
|
1866
|
-
fd?: number;
|
|
1867
|
-
mode?: number;
|
|
1868
|
-
autoClose?: boolean;
|
|
1869
|
-
emitClose?: boolean;
|
|
1870
|
-
start?: number;
|
|
1871
|
-
highWaterMark?: number;
|
|
1892
|
+
flags?: string | undefined;
|
|
1893
|
+
encoding?: string | undefined;
|
|
1894
|
+
fd?: number | undefined;
|
|
1895
|
+
mode?: number | undefined;
|
|
1896
|
+
autoClose?: boolean | undefined;
|
|
1897
|
+
emitClose?: boolean | undefined;
|
|
1898
|
+
start?: number | undefined;
|
|
1899
|
+
highWaterMark?: number | undefined;
|
|
1872
1900
|
}): WriteStream;
|
|
1873
1901
|
|
|
1874
1902
|
/**
|
|
@@ -1977,7 +2005,7 @@ declare module 'fs' {
|
|
|
1977
2005
|
function writevSync(fd: number, buffers: ReadonlyArray<NodeJS.ArrayBufferView>, position?: number): number;
|
|
1978
2006
|
|
|
1979
2007
|
interface OpenDirOptions {
|
|
1980
|
-
encoding?: BufferEncoding;
|
|
2008
|
+
encoding?: BufferEncoding | undefined;
|
|
1981
2009
|
}
|
|
1982
2010
|
|
|
1983
2011
|
function opendirSync(path: string, options?: OpenDirOptions): Dir;
|
|
@@ -2006,7 +2034,7 @@ declare module 'fs' {
|
|
|
2006
2034
|
* If `mode` is a string, it is parsed as an octal integer.
|
|
2007
2035
|
* If `flag` is not supplied, the default of `'a'` is used.
|
|
2008
2036
|
*/
|
|
2009
|
-
appendFile(data: any, options?: { encoding?: string | null, mode?: string | number, flag?: string | number } | string | null): Promise<void>;
|
|
2037
|
+
appendFile(data: any, options?: { encoding?: string | null | undefined, mode?: string | number | undefined, flag?: string | number | undefined } | string | null): Promise<void>;
|
|
2010
2038
|
|
|
2011
2039
|
/**
|
|
2012
2040
|
* Asynchronous fchown(2) - Change ownership of a file.
|
|
@@ -2045,7 +2073,7 @@ declare module 'fs' {
|
|
|
2045
2073
|
* @param options An object that may contain an optional flag.
|
|
2046
2074
|
* If a flag is not provided, it defaults to `'r'`.
|
|
2047
2075
|
*/
|
|
2048
|
-
readFile(options?: { encoding?: null, flag?: string | number } | null): Promise<Buffer>;
|
|
2076
|
+
readFile(options?: { encoding?: null | undefined, flag?: string | number | undefined } | null): Promise<Buffer>;
|
|
2049
2077
|
|
|
2050
2078
|
/**
|
|
2051
2079
|
* Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically.
|
|
@@ -2053,7 +2081,7 @@ declare module 'fs' {
|
|
|
2053
2081
|
* @param options An object that may contain an optional flag.
|
|
2054
2082
|
* If a flag is not provided, it defaults to `'r'`.
|
|
2055
2083
|
*/
|
|
2056
|
-
readFile(options: { encoding: BufferEncoding, flag?: string | number } | BufferEncoding): Promise<string>;
|
|
2084
|
+
readFile(options: { encoding: BufferEncoding, flag?: string | number | undefined } | BufferEncoding): Promise<string>;
|
|
2057
2085
|
|
|
2058
2086
|
/**
|
|
2059
2087
|
* Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically.
|
|
@@ -2061,12 +2089,12 @@ declare module 'fs' {
|
|
|
2061
2089
|
* @param options An object that may contain an optional flag.
|
|
2062
2090
|
* If a flag is not provided, it defaults to `'r'`.
|
|
2063
2091
|
*/
|
|
2064
|
-
readFile(options?: { encoding?: string | null, flag?: string | number } | string | null): Promise<string | Buffer>;
|
|
2092
|
+
readFile(options?: { encoding?: string | null | undefined, flag?: string | number | undefined } | string | null): Promise<string | Buffer>;
|
|
2065
2093
|
|
|
2066
2094
|
/**
|
|
2067
2095
|
* Asynchronous fstat(2) - Get file status.
|
|
2068
2096
|
*/
|
|
2069
|
-
stat(opts?: StatOptions & { bigint?: false }): Promise<Stats>;
|
|
2097
|
+
stat(opts?: StatOptions & { bigint?: false | undefined }): Promise<Stats>;
|
|
2070
2098
|
stat(opts: StatOptions & { bigint: true }): Promise<BigIntStats>;
|
|
2071
2099
|
stat(opts: StatOptions): Promise<Stats | BigIntStats>;
|
|
2072
2100
|
|
|
@@ -2115,7 +2143,7 @@ declare module 'fs' {
|
|
|
2115
2143
|
* If `mode` is a string, it is parsed as an octal integer.
|
|
2116
2144
|
* If `flag` is not supplied, the default of `'w'` is used.
|
|
2117
2145
|
*/
|
|
2118
|
-
writeFile(data: any, options?: { encoding?: string | null, mode?: string | number, flag?: string | number } | string | null): Promise<void>;
|
|
2146
|
+
writeFile(data: any, options?: { encoding?: string | null | undefined, mode?: string | number | undefined, flag?: string | number | undefined } | string | null): Promise<void>;
|
|
2119
2147
|
|
|
2120
2148
|
/**
|
|
2121
2149
|
* See `fs.writev` promisified version.
|
|
@@ -2254,35 +2282,35 @@ declare module 'fs' {
|
|
|
2254
2282
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
2255
2283
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
2256
2284
|
*/
|
|
2257
|
-
function readdir(path: PathLike, options?: { encoding?: BufferEncoding | null; withFileTypes?: false } | BufferEncoding | null): Promise<string[]>;
|
|
2285
|
+
function readdir(path: PathLike, options?: { encoding?: BufferEncoding | null | undefined; withFileTypes?: false | undefined } | BufferEncoding | null): Promise<string[]>;
|
|
2258
2286
|
|
|
2259
2287
|
/**
|
|
2260
2288
|
* Asynchronous readdir(3) - read a directory.
|
|
2261
2289
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
2262
2290
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
2263
2291
|
*/
|
|
2264
|
-
function readdir(path: PathLike, options: { encoding: "buffer"; withFileTypes?: false } | "buffer"): Promise<Buffer[]>;
|
|
2292
|
+
function readdir(path: PathLike, options: { encoding: "buffer"; withFileTypes?: false | undefined } | "buffer"): Promise<Buffer[]>;
|
|
2265
2293
|
|
|
2266
2294
|
/**
|
|
2267
2295
|
* Asynchronous readdir(3) - read a directory.
|
|
2268
2296
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
2269
2297
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
2270
2298
|
*/
|
|
2271
|
-
function readdir(path: PathLike, options?: { encoding?: string | null; withFileTypes?: false } | string | null): Promise<string[] | Buffer[]>;
|
|
2299
|
+
function readdir(path: PathLike, options?: { encoding?: string | null | undefined; withFileTypes?: false | undefined } | string | null): Promise<string[] | Buffer[]>;
|
|
2272
2300
|
|
|
2273
2301
|
/**
|
|
2274
2302
|
* Asynchronous readdir(3) - read a directory.
|
|
2275
2303
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
2276
2304
|
* @param options If called with `withFileTypes: true` the result data will be an array of Dirent.
|
|
2277
2305
|
*/
|
|
2278
|
-
function readdir(path: PathLike, options: { encoding?: string | null; withFileTypes: true }): Promise<Dirent[]>;
|
|
2306
|
+
function readdir(path: PathLike, options: { encoding?: string | null | undefined; withFileTypes: true }): Promise<Dirent[]>;
|
|
2279
2307
|
|
|
2280
2308
|
/**
|
|
2281
2309
|
* Asynchronous readlink(2) - read value of a symbolic link.
|
|
2282
2310
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
2283
2311
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
2284
2312
|
*/
|
|
2285
|
-
function readlink(path: PathLike, options?: { encoding?: BufferEncoding | null } | BufferEncoding | null): Promise<string>;
|
|
2313
|
+
function readlink(path: PathLike, options?: { encoding?: BufferEncoding | null | undefined } | BufferEncoding | null): Promise<string>;
|
|
2286
2314
|
|
|
2287
2315
|
/**
|
|
2288
2316
|
* Asynchronous readlink(2) - read value of a symbolic link.
|
|
@@ -2296,7 +2324,7 @@ declare module 'fs' {
|
|
|
2296
2324
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
2297
2325
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
2298
2326
|
*/
|
|
2299
|
-
function readlink(path: PathLike, options?: { encoding?: string | null } | string | null): Promise<string | Buffer>;
|
|
2327
|
+
function readlink(path: PathLike, options?: { encoding?: string | null | undefined } | string | null): Promise<string | Buffer>;
|
|
2300
2328
|
|
|
2301
2329
|
/**
|
|
2302
2330
|
* Asynchronous symlink(2) - Create a new symbolic link to an existing file.
|
|
@@ -2311,7 +2339,7 @@ declare module 'fs' {
|
|
|
2311
2339
|
* Asynchronous lstat(2) - Get file status. Does not dereference symbolic links.
|
|
2312
2340
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
2313
2341
|
*/
|
|
2314
|
-
function lstat(path: PathLike, opts?: StatOptions & { bigint?: false }): Promise<Stats>;
|
|
2342
|
+
function lstat(path: PathLike, opts?: StatOptions & { bigint?: false | undefined }): Promise<Stats>;
|
|
2315
2343
|
function lstat(path: PathLike, opts: StatOptions & { bigint: true }): Promise<BigIntStats>;
|
|
2316
2344
|
function lstat(path: PathLike, opts?: StatOptions): Promise<Stats | BigIntStats>;
|
|
2317
2345
|
|
|
@@ -2319,7 +2347,7 @@ declare module 'fs' {
|
|
|
2319
2347
|
* Asynchronous stat(2) - Get file status.
|
|
2320
2348
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
2321
2349
|
*/
|
|
2322
|
-
function stat(path: PathLike, opts?: StatOptions & { bigint?: false }): Promise<Stats>;
|
|
2350
|
+
function stat(path: PathLike, opts?: StatOptions & { bigint?: false | undefined }): Promise<Stats>;
|
|
2323
2351
|
function stat(path: PathLike, opts: StatOptions & { bigint: true }): Promise<BigIntStats>;
|
|
2324
2352
|
function stat(path: PathLike, opts?: StatOptions): Promise<Stats | BigIntStats>;
|
|
2325
2353
|
|
|
@@ -2406,7 +2434,7 @@ declare module 'fs' {
|
|
|
2406
2434
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
2407
2435
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
2408
2436
|
*/
|
|
2409
|
-
function realpath(path: PathLike, options?: { encoding?: BufferEncoding | null } | BufferEncoding | null): Promise<string>;
|
|
2437
|
+
function realpath(path: PathLike, options?: { encoding?: BufferEncoding | null | undefined } | BufferEncoding | null): Promise<string>;
|
|
2410
2438
|
|
|
2411
2439
|
/**
|
|
2412
2440
|
* Asynchronous realpath(3) - return the canonicalized absolute pathname.
|
|
@@ -2420,14 +2448,14 @@ declare module 'fs' {
|
|
|
2420
2448
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
2421
2449
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
2422
2450
|
*/
|
|
2423
|
-
function realpath(path: PathLike, options?: { encoding?: string | null } | string | null): Promise<string | Buffer>;
|
|
2451
|
+
function realpath(path: PathLike, options?: { encoding?: string | null | undefined } | string | null): Promise<string | Buffer>;
|
|
2424
2452
|
|
|
2425
2453
|
/**
|
|
2426
2454
|
* Asynchronously creates a unique temporary directory.
|
|
2427
2455
|
* Generates six random characters to be appended behind a required `prefix` to create a unique temporary directory.
|
|
2428
2456
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
2429
2457
|
*/
|
|
2430
|
-
function mkdtemp(prefix: string, options?: { encoding?: BufferEncoding | null } | BufferEncoding | null): Promise<string>;
|
|
2458
|
+
function mkdtemp(prefix: string, options?: { encoding?: BufferEncoding | null | undefined } | BufferEncoding | null): Promise<string>;
|
|
2431
2459
|
|
|
2432
2460
|
/**
|
|
2433
2461
|
* Asynchronously creates a unique temporary directory.
|
|
@@ -2441,7 +2469,7 @@ declare module 'fs' {
|
|
|
2441
2469
|
* Generates six random characters to be appended behind a required `prefix` to create a unique temporary directory.
|
|
2442
2470
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
2443
2471
|
*/
|
|
2444
|
-
function mkdtemp(prefix: string, options?: { encoding?: string | null } | string | null): Promise<string | Buffer>;
|
|
2472
|
+
function mkdtemp(prefix: string, options?: { encoding?: string | null | undefined } | string | null): Promise<string | Buffer>;
|
|
2445
2473
|
|
|
2446
2474
|
/**
|
|
2447
2475
|
* Asynchronously writes data to a file, replacing the file if it already exists.
|
|
@@ -2456,7 +2484,11 @@ declare module 'fs' {
|
|
|
2456
2484
|
* If `mode` is a string, it is parsed as an octal integer.
|
|
2457
2485
|
* If `flag` is not supplied, the default of `'w'` is used.
|
|
2458
2486
|
*/
|
|
2459
|
-
function writeFile(
|
|
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>;
|
|
2460
2492
|
|
|
2461
2493
|
/**
|
|
2462
2494
|
* Asynchronously append data to a file, creating the file if it does not exist.
|
|
@@ -2470,7 +2502,11 @@ declare module 'fs' {
|
|
|
2470
2502
|
* If `mode` is a string, it is parsed as an octal integer.
|
|
2471
2503
|
* If `flag` is not supplied, the default of `'a'` is used.
|
|
2472
2504
|
*/
|
|
2473
|
-
function appendFile(
|
|
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>;
|
|
2474
2510
|
|
|
2475
2511
|
/**
|
|
2476
2512
|
* Asynchronously reads the entire contents of a file.
|
|
@@ -2479,7 +2515,7 @@ declare module 'fs' {
|
|
|
2479
2515
|
* @param options An object that may contain an optional flag.
|
|
2480
2516
|
* If a flag is not provided, it defaults to `'r'`.
|
|
2481
2517
|
*/
|
|
2482
|
-
function readFile(path: PathLike | FileHandle, options?: { encoding?: null, flag?: string | number } | null): Promise<Buffer>;
|
|
2518
|
+
function readFile(path: PathLike | FileHandle, options?: { encoding?: null | undefined, flag?: string | number | undefined } | null): Promise<Buffer>;
|
|
2483
2519
|
|
|
2484
2520
|
/**
|
|
2485
2521
|
* Asynchronously reads the entire contents of a file.
|
|
@@ -2488,7 +2524,7 @@ declare module 'fs' {
|
|
|
2488
2524
|
* @param options An object that may contain an optional flag.
|
|
2489
2525
|
* If a flag is not provided, it defaults to `'r'`.
|
|
2490
2526
|
*/
|
|
2491
|
-
function readFile(path: PathLike | FileHandle, options: { encoding: BufferEncoding, flag?: string | number } | BufferEncoding): Promise<string>;
|
|
2527
|
+
function readFile(path: PathLike | FileHandle, options: { encoding: BufferEncoding, flag?: string | number | undefined } | BufferEncoding): Promise<string>;
|
|
2492
2528
|
|
|
2493
2529
|
/**
|
|
2494
2530
|
* Asynchronously reads the entire contents of a file.
|
|
@@ -2497,7 +2533,7 @@ declare module 'fs' {
|
|
|
2497
2533
|
* @param options An object that may contain an optional flag.
|
|
2498
2534
|
* If a flag is not provided, it defaults to `'r'`.
|
|
2499
2535
|
*/
|
|
2500
|
-
function readFile(path: PathLike | FileHandle, options?: { encoding?: string | null, flag?: string | number } | string | null): Promise<string | Buffer>;
|
|
2536
|
+
function readFile(path: PathLike | FileHandle, options?: { encoding?: string | null | undefined, flag?: string | number | undefined } | string | null): Promise<string | Buffer>;
|
|
2501
2537
|
|
|
2502
2538
|
function opendir(path: string, options?: OpenDirOptions): Promise<Dir>;
|
|
2503
2539
|
}
|