@types/node 14.18.62 → 14.18.63
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- node v14.18/README.md +1 -1
- node v14.18/assert.d.ts +33 -31
- node v14.18/async_hooks.d.ts +27 -20
- node v14.18/buffer.d.ts +4 -4
- node v14.18/child_process.d.ts +191 -62
- node v14.18/cluster.d.ts +59 -28
- node v14.18/console.d.ts +6 -6
- node v14.18/constants.d.ts +12 -11
- node v14.18/crypto.d.ts +232 -228
- node v14.18/dgram.d.ts +50 -14
- node v14.18/dns.d.ts +183 -54
- node v14.18/domain.d.ts +4 -4
- node v14.18/events.d.ts +4 -4
- node v14.18/fs/promises.d.ts +87 -25
- node v14.18/fs.d.ts +404 -104
- node v14.18/globals.d.ts +33 -16
- node v14.18/http.d.ts +201 -201
- node v14.18/http2.d.ts +340 -93
- node v14.18/https.d.ts +107 -105
- node v14.18/module.d.ts +4 -4
- node v14.18/net.d.ts +27 -12
- node v14.18/os.d.ts +4 -4
- node v14.18/package.json +2 -2
- node v14.18/path.d.ts +5 -5
- node v14.18/perf_hooks.d.ts +5 -5
- node v14.18/process.d.ts +61 -22
- node v14.18/punycode.d.ts +3 -3
- node v14.18/querystring.d.ts +15 -5
- node v14.18/readline.d.ts +16 -6
- node v14.18/repl.d.ts +13 -7
- node v14.18/stream.d.ts +160 -100
- node v14.18/string_decoder.d.ts +3 -3
- node v14.18/timers.d.ts +3 -3
- node v14.18/tls.d.ts +109 -27
- node v14.18/trace_events.d.ts +3 -3
- node v14.18/ts4.8/assert.d.ts +33 -31
- node v14.18/ts4.8/async_hooks.d.ts +27 -20
- node v14.18/ts4.8/buffer.d.ts +4 -4
- node v14.18/ts4.8/child_process.d.ts +191 -62
- node v14.18/ts4.8/cluster.d.ts +59 -28
- node v14.18/ts4.8/console.d.ts +6 -6
- node v14.18/ts4.8/constants.d.ts +12 -11
- node v14.18/ts4.8/crypto.d.ts +232 -228
- node v14.18/ts4.8/dgram.d.ts +50 -14
- node v14.18/ts4.8/dns.d.ts +183 -54
- node v14.18/ts4.8/domain.d.ts +4 -4
- node v14.18/ts4.8/events.d.ts +4 -4
- node v14.18/ts4.8/fs/promises.d.ts +87 -25
- node v14.18/ts4.8/fs.d.ts +404 -104
- node v14.18/ts4.8/globals.d.ts +33 -16
- node v14.18/ts4.8/http.d.ts +200 -200
- node v14.18/ts4.8/http2.d.ts +340 -93
- node v14.18/ts4.8/https.d.ts +107 -105
- node v14.18/ts4.8/module.d.ts +4 -4
- node v14.18/ts4.8/net.d.ts +27 -12
- node v14.18/ts4.8/os.d.ts +4 -4
- node v14.18/ts4.8/path.d.ts +5 -5
- node v14.18/ts4.8/perf_hooks.d.ts +5 -5
- node v14.18/ts4.8/process.d.ts +61 -22
- node v14.18/ts4.8/punycode.d.ts +3 -3
- node v14.18/ts4.8/querystring.d.ts +15 -5
- node v14.18/ts4.8/readline.d.ts +16 -6
- node v14.18/ts4.8/repl.d.ts +13 -7
- node v14.18/ts4.8/stream.d.ts +160 -100
- node v14.18/ts4.8/string_decoder.d.ts +3 -3
- node v14.18/ts4.8/timers.d.ts +3 -3
- node v14.18/ts4.8/tls.d.ts +109 -27
- node v14.18/ts4.8/trace_events.d.ts +3 -3
- node v14.18/ts4.8/tty.d.ts +4 -4
- node v14.18/ts4.8/url.d.ts +21 -12
- node v14.18/ts4.8/util.d.ts +102 -40
- node v14.18/ts4.8/v8.d.ts +4 -5
- node v14.18/ts4.8/vm.d.ts +7 -7
- node v14.18/ts4.8/wasi.d.ts +3 -4
- node v14.18/ts4.8/worker_threads.d.ts +8 -8
- node v14.18/ts4.8/zlib.d.ts +13 -13
- node v14.18/tty.d.ts +4 -4
- node v14.18/url.d.ts +21 -12
- node v14.18/util.d.ts +102 -40
- node v14.18/v8.d.ts +4 -5
- node v14.18/vm.d.ts +7 -7
- node v14.18/wasi.d.ts +3 -4
- node v14.18/worker_threads.d.ts +8 -8
- node v14.18/zlib.d.ts +13 -13
node v14.18/ts4.8/fs.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
declare module
|
|
2
|
-
import * as stream from
|
|
3
|
-
import EventEmitter = require(
|
|
4
|
-
import { URL } from
|
|
5
|
-
import * as promises from
|
|
1
|
+
declare module "fs" {
|
|
2
|
+
import * as stream from "stream";
|
|
3
|
+
import EventEmitter = require("events");
|
|
4
|
+
import { URL } from "url";
|
|
5
|
+
import * as promises from "fs/promises";
|
|
6
6
|
|
|
7
7
|
export { promises };
|
|
8
8
|
/**
|
|
@@ -12,7 +12,7 @@ declare module 'fs' {
|
|
|
12
12
|
|
|
13
13
|
export type NoParamCallback = (err: NodeJS.ErrnoException | null) => void;
|
|
14
14
|
|
|
15
|
-
export type BufferEncodingOption =
|
|
15
|
+
export type BufferEncodingOption = "buffer" | { encoding: "buffer" };
|
|
16
16
|
|
|
17
17
|
export interface BaseEncodingOptions {
|
|
18
18
|
encoding?: BufferEncoding | null | undefined;
|
|
@@ -435,7 +435,12 @@ declare module 'fs' {
|
|
|
435
435
|
* @param atime The last access time. If a string is provided, it will be coerced to number.
|
|
436
436
|
* @param mtime The last modified time. If a string is provided, it will be coerced to number.
|
|
437
437
|
*/
|
|
438
|
-
export function lutimes(
|
|
438
|
+
export function lutimes(
|
|
439
|
+
path: PathLike,
|
|
440
|
+
atime: string | number | Date,
|
|
441
|
+
mtime: string | number | Date,
|
|
442
|
+
callback: NoParamCallback,
|
|
443
|
+
): void;
|
|
439
444
|
|
|
440
445
|
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
|
|
441
446
|
export namespace lutimes {
|
|
@@ -447,7 +452,11 @@ declare module 'fs' {
|
|
|
447
452
|
* @param atime The last access time. If a string is provided, it will be coerced to number.
|
|
448
453
|
* @param mtime The last modified time. If a string is provided, it will be coerced to number.
|
|
449
454
|
*/
|
|
450
|
-
function __promisify__(
|
|
455
|
+
function __promisify__(
|
|
456
|
+
path: PathLike,
|
|
457
|
+
atime: string | number | Date,
|
|
458
|
+
mtime: string | number | Date,
|
|
459
|
+
): Promise<void>;
|
|
451
460
|
}
|
|
452
461
|
|
|
453
462
|
/**
|
|
@@ -537,9 +546,21 @@ declare module 'fs' {
|
|
|
537
546
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
538
547
|
*/
|
|
539
548
|
export function stat(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
|
|
540
|
-
export function stat(
|
|
541
|
-
|
|
542
|
-
|
|
549
|
+
export function stat(
|
|
550
|
+
path: PathLike,
|
|
551
|
+
options: StatOptions & { bigint?: false | undefined } | undefined,
|
|
552
|
+
callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void,
|
|
553
|
+
): void;
|
|
554
|
+
export function stat(
|
|
555
|
+
path: PathLike,
|
|
556
|
+
options: StatOptions & { bigint: true },
|
|
557
|
+
callback: (err: NodeJS.ErrnoException | null, stats: BigIntStats) => void,
|
|
558
|
+
): void;
|
|
559
|
+
export function stat(
|
|
560
|
+
path: PathLike,
|
|
561
|
+
options: StatOptions | undefined,
|
|
562
|
+
callback: (err: NodeJS.ErrnoException | null, stats: Stats | BigIntStats) => void,
|
|
563
|
+
): void;
|
|
543
564
|
|
|
544
565
|
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
|
|
545
566
|
export namespace stat {
|
|
@@ -565,9 +586,21 @@ declare module 'fs' {
|
|
|
565
586
|
* @param fd A file descriptor.
|
|
566
587
|
*/
|
|
567
588
|
export function fstat(fd: number, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
|
|
568
|
-
export function fstat(
|
|
569
|
-
|
|
570
|
-
|
|
589
|
+
export function fstat(
|
|
590
|
+
fd: number,
|
|
591
|
+
options: StatOptions & { bigint?: false | undefined } | undefined,
|
|
592
|
+
callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void,
|
|
593
|
+
): void;
|
|
594
|
+
export function fstat(
|
|
595
|
+
fd: number,
|
|
596
|
+
options: StatOptions & { bigint: true },
|
|
597
|
+
callback: (err: NodeJS.ErrnoException | null, stats: BigIntStats) => void,
|
|
598
|
+
): void;
|
|
599
|
+
export function fstat(
|
|
600
|
+
fd: number,
|
|
601
|
+
options: StatOptions | undefined,
|
|
602
|
+
callback: (err: NodeJS.ErrnoException | null, stats: Stats | BigIntStats) => void,
|
|
603
|
+
): void;
|
|
571
604
|
|
|
572
605
|
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
|
|
573
606
|
export namespace fstat {
|
|
@@ -593,9 +626,21 @@ declare module 'fs' {
|
|
|
593
626
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
594
627
|
*/
|
|
595
628
|
export function lstat(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
|
|
596
|
-
export function lstat(
|
|
597
|
-
|
|
598
|
-
|
|
629
|
+
export function lstat(
|
|
630
|
+
path: PathLike,
|
|
631
|
+
options: StatOptions & { bigint?: false | undefined } | undefined,
|
|
632
|
+
callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void,
|
|
633
|
+
): void;
|
|
634
|
+
export function lstat(
|
|
635
|
+
path: PathLike,
|
|
636
|
+
options: StatOptions & { bigint: true },
|
|
637
|
+
callback: (err: NodeJS.ErrnoException | null, stats: BigIntStats) => void,
|
|
638
|
+
): void;
|
|
639
|
+
export function lstat(
|
|
640
|
+
path: PathLike,
|
|
641
|
+
options: StatOptions | undefined,
|
|
642
|
+
callback: (err: NodeJS.ErrnoException | null, stats: Stats | BigIntStats) => void,
|
|
643
|
+
): void;
|
|
599
644
|
|
|
600
645
|
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
|
|
601
646
|
export namespace lstat {
|
|
@@ -647,7 +692,12 @@ declare module 'fs' {
|
|
|
647
692
|
* @param type May be set to `'dir'`, `'file'`, or `'junction'` (default is `'file'`) and is only available on Windows (ignored on other platforms).
|
|
648
693
|
* When using `'junction'`, the `target` argument will automatically be normalized to an absolute path.
|
|
649
694
|
*/
|
|
650
|
-
export function symlink(
|
|
695
|
+
export function symlink(
|
|
696
|
+
target: PathLike,
|
|
697
|
+
path: PathLike,
|
|
698
|
+
type: symlink.Type | undefined | null,
|
|
699
|
+
callback: NoParamCallback,
|
|
700
|
+
): void;
|
|
651
701
|
|
|
652
702
|
/**
|
|
653
703
|
* Asynchronous symlink(2) - Create a new symbolic link to an existing file.
|
|
@@ -687,7 +737,7 @@ declare module 'fs' {
|
|
|
687
737
|
export function readlink(
|
|
688
738
|
path: PathLike,
|
|
689
739
|
options: BaseEncodingOptions | BufferEncoding | undefined | null,
|
|
690
|
-
callback: (err: NodeJS.ErrnoException | null, linkString: string) => void
|
|
740
|
+
callback: (err: NodeJS.ErrnoException | null, linkString: string) => void,
|
|
691
741
|
): void;
|
|
692
742
|
|
|
693
743
|
/**
|
|
@@ -695,20 +745,31 @@ declare module 'fs' {
|
|
|
695
745
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
696
746
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
697
747
|
*/
|
|
698
|
-
export function readlink(
|
|
748
|
+
export function readlink(
|
|
749
|
+
path: PathLike,
|
|
750
|
+
options: BufferEncodingOption,
|
|
751
|
+
callback: (err: NodeJS.ErrnoException | null, linkString: Buffer) => void,
|
|
752
|
+
): void;
|
|
699
753
|
|
|
700
754
|
/**
|
|
701
755
|
* Asynchronous readlink(2) - read value of a symbolic link.
|
|
702
756
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
703
757
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
704
758
|
*/
|
|
705
|
-
export function readlink(
|
|
759
|
+
export function readlink(
|
|
760
|
+
path: PathLike,
|
|
761
|
+
options: BaseEncodingOptions | string | undefined | null,
|
|
762
|
+
callback: (err: NodeJS.ErrnoException | null, linkString: string | Buffer) => void,
|
|
763
|
+
): void;
|
|
706
764
|
|
|
707
765
|
/**
|
|
708
766
|
* Asynchronous readlink(2) - read value of a symbolic link.
|
|
709
767
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
710
768
|
*/
|
|
711
|
-
export function readlink(
|
|
769
|
+
export function readlink(
|
|
770
|
+
path: PathLike,
|
|
771
|
+
callback: (err: NodeJS.ErrnoException | null, linkString: string) => void,
|
|
772
|
+
): void;
|
|
712
773
|
|
|
713
774
|
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
|
|
714
775
|
export namespace readlink {
|
|
@@ -763,7 +824,7 @@ declare module 'fs' {
|
|
|
763
824
|
export function realpath(
|
|
764
825
|
path: PathLike,
|
|
765
826
|
options: BaseEncodingOptions | BufferEncoding | undefined | null,
|
|
766
|
-
callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void
|
|
827
|
+
callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void,
|
|
767
828
|
): void;
|
|
768
829
|
|
|
769
830
|
/**
|
|
@@ -771,20 +832,31 @@ declare module 'fs' {
|
|
|
771
832
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
772
833
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
773
834
|
*/
|
|
774
|
-
export function realpath(
|
|
835
|
+
export function realpath(
|
|
836
|
+
path: PathLike,
|
|
837
|
+
options: BufferEncodingOption,
|
|
838
|
+
callback: (err: NodeJS.ErrnoException | null, resolvedPath: Buffer) => void,
|
|
839
|
+
): void;
|
|
775
840
|
|
|
776
841
|
/**
|
|
777
842
|
* Asynchronous realpath(3) - return the canonicalized absolute pathname.
|
|
778
843
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
779
844
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
780
845
|
*/
|
|
781
|
-
export function realpath(
|
|
846
|
+
export function realpath(
|
|
847
|
+
path: PathLike,
|
|
848
|
+
options: BaseEncodingOptions | string | undefined | null,
|
|
849
|
+
callback: (err: NodeJS.ErrnoException | null, resolvedPath: string | Buffer) => void,
|
|
850
|
+
): void;
|
|
782
851
|
|
|
783
852
|
/**
|
|
784
853
|
* Asynchronous realpath(3) - return the canonicalized absolute pathname.
|
|
785
854
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
786
855
|
*/
|
|
787
|
-
export function realpath(
|
|
856
|
+
export function realpath(
|
|
857
|
+
path: PathLike,
|
|
858
|
+
callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void,
|
|
859
|
+
): void;
|
|
788
860
|
|
|
789
861
|
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
|
|
790
862
|
export namespace realpath {
|
|
@@ -812,11 +884,22 @@ declare module 'fs' {
|
|
|
812
884
|
function native(
|
|
813
885
|
path: PathLike,
|
|
814
886
|
options: BaseEncodingOptions | BufferEncoding | undefined | null,
|
|
815
|
-
callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void
|
|
887
|
+
callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void,
|
|
888
|
+
): void;
|
|
889
|
+
function native(
|
|
890
|
+
path: PathLike,
|
|
891
|
+
options: BufferEncodingOption,
|
|
892
|
+
callback: (err: NodeJS.ErrnoException | null, resolvedPath: Buffer) => void,
|
|
893
|
+
): void;
|
|
894
|
+
function native(
|
|
895
|
+
path: PathLike,
|
|
896
|
+
options: BaseEncodingOptions | string | undefined | null,
|
|
897
|
+
callback: (err: NodeJS.ErrnoException | null, resolvedPath: string | Buffer) => void,
|
|
898
|
+
): void;
|
|
899
|
+
function native(
|
|
900
|
+
path: PathLike,
|
|
901
|
+
callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void,
|
|
816
902
|
): void;
|
|
817
|
-
function native(path: PathLike, options: BufferEncodingOption, callback: (err: NodeJS.ErrnoException | null, resolvedPath: Buffer) => void): void;
|
|
818
|
-
function native(path: PathLike, options: BaseEncodingOptions | string | undefined | null, callback: (err: NodeJS.ErrnoException | null, resolvedPath: string | Buffer) => void): void;
|
|
819
|
-
function native(path: PathLike, callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void): void;
|
|
820
903
|
}
|
|
821
904
|
|
|
822
905
|
/**
|
|
@@ -988,7 +1071,11 @@ declare module 'fs' {
|
|
|
988
1071
|
* @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
|
|
989
1072
|
* should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
|
|
990
1073
|
*/
|
|
991
|
-
export function mkdir(
|
|
1074
|
+
export function mkdir(
|
|
1075
|
+
path: PathLike,
|
|
1076
|
+
options: MakeDirectoryOptions & { recursive: true },
|
|
1077
|
+
callback: (err: NodeJS.ErrnoException | null, path?: string) => void,
|
|
1078
|
+
): void;
|
|
992
1079
|
|
|
993
1080
|
/**
|
|
994
1081
|
* Asynchronous mkdir(2) - create a directory.
|
|
@@ -996,7 +1083,11 @@ declare module 'fs' {
|
|
|
996
1083
|
* @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
|
|
997
1084
|
* should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
|
|
998
1085
|
*/
|
|
999
|
-
export function mkdir(
|
|
1086
|
+
export function mkdir(
|
|
1087
|
+
path: PathLike,
|
|
1088
|
+
options: Mode | (MakeDirectoryOptions & { recursive?: false | undefined }) | null | undefined,
|
|
1089
|
+
callback: NoParamCallback,
|
|
1090
|
+
): void;
|
|
1000
1091
|
|
|
1001
1092
|
/**
|
|
1002
1093
|
* Asynchronous mkdir(2) - create a directory.
|
|
@@ -1004,7 +1095,11 @@ declare module 'fs' {
|
|
|
1004
1095
|
* @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
|
|
1005
1096
|
* should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
|
|
1006
1097
|
*/
|
|
1007
|
-
export function mkdir(
|
|
1098
|
+
export function mkdir(
|
|
1099
|
+
path: PathLike,
|
|
1100
|
+
options: Mode | MakeDirectoryOptions | null | undefined,
|
|
1101
|
+
callback: (err: NodeJS.ErrnoException | null, path?: string) => void,
|
|
1102
|
+
): void;
|
|
1008
1103
|
|
|
1009
1104
|
/**
|
|
1010
1105
|
* Asynchronous mkdir(2) - create a directory with a mode of `0o777`.
|
|
@@ -1020,7 +1115,10 @@ declare module 'fs' {
|
|
|
1020
1115
|
* @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
|
|
1021
1116
|
* should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
|
|
1022
1117
|
*/
|
|
1023
|
-
function __promisify__(
|
|
1118
|
+
function __promisify__(
|
|
1119
|
+
path: PathLike,
|
|
1120
|
+
options: MakeDirectoryOptions & { recursive: true },
|
|
1121
|
+
): Promise<string | undefined>;
|
|
1024
1122
|
|
|
1025
1123
|
/**
|
|
1026
1124
|
* Asynchronous mkdir(2) - create a directory.
|
|
@@ -1028,7 +1126,10 @@ declare module 'fs' {
|
|
|
1028
1126
|
* @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
|
|
1029
1127
|
* should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
|
|
1030
1128
|
*/
|
|
1031
|
-
function __promisify__(
|
|
1129
|
+
function __promisify__(
|
|
1130
|
+
path: PathLike,
|
|
1131
|
+
options?: Mode | (MakeDirectoryOptions & { recursive?: false | undefined }) | null,
|
|
1132
|
+
): Promise<void>;
|
|
1032
1133
|
|
|
1033
1134
|
/**
|
|
1034
1135
|
* Asynchronous mkdir(2) - create a directory.
|
|
@@ -1036,7 +1137,10 @@ declare module 'fs' {
|
|
|
1036
1137
|
* @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
|
|
1037
1138
|
* should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
|
|
1038
1139
|
*/
|
|
1039
|
-
function __promisify__(
|
|
1140
|
+
function __promisify__(
|
|
1141
|
+
path: PathLike,
|
|
1142
|
+
options?: Mode | MakeDirectoryOptions | null,
|
|
1143
|
+
): Promise<string | undefined>;
|
|
1040
1144
|
}
|
|
1041
1145
|
|
|
1042
1146
|
/**
|
|
@@ -1045,7 +1149,7 @@ declare module 'fs' {
|
|
|
1045
1149
|
* @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
|
|
1046
1150
|
* should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
|
|
1047
1151
|
*/
|
|
1048
|
-
export function mkdirSync(path: PathLike, options: MakeDirectoryOptions & { recursive: true
|
|
1152
|
+
export function mkdirSync(path: PathLike, options: MakeDirectoryOptions & { recursive: true }): string | undefined;
|
|
1049
1153
|
|
|
1050
1154
|
/**
|
|
1051
1155
|
* Synchronous mkdir(2) - create a directory.
|
|
@@ -1053,7 +1157,10 @@ declare module 'fs' {
|
|
|
1053
1157
|
* @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
|
|
1054
1158
|
* should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
|
|
1055
1159
|
*/
|
|
1056
|
-
export function mkdirSync(
|
|
1160
|
+
export function mkdirSync(
|
|
1161
|
+
path: PathLike,
|
|
1162
|
+
options?: Mode | (MakeDirectoryOptions & { recursive?: false | undefined }) | null,
|
|
1163
|
+
): void;
|
|
1057
1164
|
|
|
1058
1165
|
/**
|
|
1059
1166
|
* Synchronous mkdir(2) - create a directory.
|
|
@@ -1068,27 +1175,42 @@ declare module 'fs' {
|
|
|
1068
1175
|
* Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
|
|
1069
1176
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1070
1177
|
*/
|
|
1071
|
-
export function mkdtemp(
|
|
1178
|
+
export function mkdtemp(
|
|
1179
|
+
prefix: string,
|
|
1180
|
+
options: BaseEncodingOptions | BufferEncoding | undefined | null,
|
|
1181
|
+
callback: (err: NodeJS.ErrnoException | null, folder: string) => void,
|
|
1182
|
+
): void;
|
|
1072
1183
|
|
|
1073
1184
|
/**
|
|
1074
1185
|
* Asynchronously creates a unique temporary directory.
|
|
1075
1186
|
* Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
|
|
1076
1187
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1077
1188
|
*/
|
|
1078
|
-
export function mkdtemp(
|
|
1189
|
+
export function mkdtemp(
|
|
1190
|
+
prefix: string,
|
|
1191
|
+
options: "buffer" | { encoding: "buffer" },
|
|
1192
|
+
callback: (err: NodeJS.ErrnoException | null, folder: Buffer) => void,
|
|
1193
|
+
): void;
|
|
1079
1194
|
|
|
1080
1195
|
/**
|
|
1081
1196
|
* Asynchronously creates a unique temporary directory.
|
|
1082
1197
|
* Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
|
|
1083
1198
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1084
1199
|
*/
|
|
1085
|
-
export function mkdtemp(
|
|
1200
|
+
export function mkdtemp(
|
|
1201
|
+
prefix: string,
|
|
1202
|
+
options: BaseEncodingOptions | string | undefined | null,
|
|
1203
|
+
callback: (err: NodeJS.ErrnoException | null, folder: string | Buffer) => void,
|
|
1204
|
+
): void;
|
|
1086
1205
|
|
|
1087
1206
|
/**
|
|
1088
1207
|
* Asynchronously creates a unique temporary directory.
|
|
1089
1208
|
* Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
|
|
1090
1209
|
*/
|
|
1091
|
-
export function mkdtemp(
|
|
1210
|
+
export function mkdtemp(
|
|
1211
|
+
prefix: string,
|
|
1212
|
+
callback: (err: NodeJS.ErrnoException | null, folder: string) => void,
|
|
1213
|
+
): void;
|
|
1092
1214
|
|
|
1093
1215
|
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
|
|
1094
1216
|
export namespace mkdtemp {
|
|
@@ -1142,7 +1264,11 @@ declare module 'fs' {
|
|
|
1142
1264
|
*/
|
|
1143
1265
|
export function readdir(
|
|
1144
1266
|
path: PathLike,
|
|
1145
|
-
options:
|
|
1267
|
+
options:
|
|
1268
|
+
| { encoding: BufferEncoding | null; withFileTypes?: false | undefined }
|
|
1269
|
+
| BufferEncoding
|
|
1270
|
+
| undefined
|
|
1271
|
+
| null,
|
|
1146
1272
|
callback: (err: NodeJS.ErrnoException | null, files: string[]) => void,
|
|
1147
1273
|
): void;
|
|
1148
1274
|
|
|
@@ -1154,7 +1280,7 @@ declare module 'fs' {
|
|
|
1154
1280
|
export function readdir(
|
|
1155
1281
|
path: PathLike,
|
|
1156
1282
|
options: { encoding: "buffer"; withFileTypes?: false | undefined } | "buffer",
|
|
1157
|
-
callback: (err: NodeJS.ErrnoException | null, files: Buffer[]) => void
|
|
1283
|
+
callback: (err: NodeJS.ErrnoException | null, files: Buffer[]) => void,
|
|
1158
1284
|
): void;
|
|
1159
1285
|
|
|
1160
1286
|
/**
|
|
@@ -1172,14 +1298,21 @@ declare module 'fs' {
|
|
|
1172
1298
|
* Asynchronous readdir(3) - read a directory.
|
|
1173
1299
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1174
1300
|
*/
|
|
1175
|
-
export function readdir(
|
|
1301
|
+
export function readdir(
|
|
1302
|
+
path: PathLike,
|
|
1303
|
+
callback: (err: NodeJS.ErrnoException | null, files: string[]) => void,
|
|
1304
|
+
): void;
|
|
1176
1305
|
|
|
1177
1306
|
/**
|
|
1178
1307
|
* Asynchronous readdir(3) - read a directory.
|
|
1179
1308
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1180
1309
|
* @param options If called with `withFileTypes: true` the result data will be an array of Dirent.
|
|
1181
1310
|
*/
|
|
1182
|
-
export function readdir(
|
|
1311
|
+
export function readdir(
|
|
1312
|
+
path: PathLike,
|
|
1313
|
+
options: BaseEncodingOptions & { withFileTypes: true },
|
|
1314
|
+
callback: (err: NodeJS.ErrnoException | null, files: Dirent[]) => void,
|
|
1315
|
+
): void;
|
|
1183
1316
|
|
|
1184
1317
|
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
|
|
1185
1318
|
export namespace readdir {
|
|
@@ -1188,28 +1321,40 @@ declare module 'fs' {
|
|
|
1188
1321
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1189
1322
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1190
1323
|
*/
|
|
1191
|
-
function __promisify__(
|
|
1324
|
+
function __promisify__(
|
|
1325
|
+
path: PathLike,
|
|
1326
|
+
options?: { encoding: BufferEncoding | null; withFileTypes?: false | undefined } | BufferEncoding | null,
|
|
1327
|
+
): Promise<string[]>;
|
|
1192
1328
|
|
|
1193
1329
|
/**
|
|
1194
1330
|
* Asynchronous readdir(3) - read a directory.
|
|
1195
1331
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1196
1332
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1197
1333
|
*/
|
|
1198
|
-
function __promisify__(
|
|
1334
|
+
function __promisify__(
|
|
1335
|
+
path: PathLike,
|
|
1336
|
+
options: "buffer" | { encoding: "buffer"; withFileTypes?: false | undefined },
|
|
1337
|
+
): Promise<Buffer[]>;
|
|
1199
1338
|
|
|
1200
1339
|
/**
|
|
1201
1340
|
* Asynchronous readdir(3) - read a directory.
|
|
1202
1341
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1203
1342
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1204
1343
|
*/
|
|
1205
|
-
function __promisify__(
|
|
1344
|
+
function __promisify__(
|
|
1345
|
+
path: PathLike,
|
|
1346
|
+
options?: BaseEncodingOptions & { withFileTypes?: false | undefined } | BufferEncoding | null,
|
|
1347
|
+
): Promise<string[] | Buffer[]>;
|
|
1206
1348
|
|
|
1207
1349
|
/**
|
|
1208
1350
|
* Asynchronous readdir(3) - read a directory.
|
|
1209
1351
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1210
1352
|
* @param options If called with `withFileTypes: true` the result data will be an array of Dirent
|
|
1211
1353
|
*/
|
|
1212
|
-
function __promisify__(
|
|
1354
|
+
function __promisify__(
|
|
1355
|
+
path: PathLike,
|
|
1356
|
+
options: BaseEncodingOptions & { withFileTypes: true },
|
|
1357
|
+
): Promise<Dirent[]>;
|
|
1213
1358
|
}
|
|
1214
1359
|
|
|
1215
1360
|
/**
|
|
@@ -1217,21 +1362,30 @@ declare module 'fs' {
|
|
|
1217
1362
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1218
1363
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1219
1364
|
*/
|
|
1220
|
-
export function readdirSync(
|
|
1365
|
+
export function readdirSync(
|
|
1366
|
+
path: PathLike,
|
|
1367
|
+
options?: { encoding: BufferEncoding | null; withFileTypes?: false | undefined } | BufferEncoding | null,
|
|
1368
|
+
): string[];
|
|
1221
1369
|
|
|
1222
1370
|
/**
|
|
1223
1371
|
* Synchronous readdir(3) - read a directory.
|
|
1224
1372
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1225
1373
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1226
1374
|
*/
|
|
1227
|
-
export function readdirSync(
|
|
1375
|
+
export function readdirSync(
|
|
1376
|
+
path: PathLike,
|
|
1377
|
+
options: { encoding: "buffer"; withFileTypes?: false | undefined } | "buffer",
|
|
1378
|
+
): Buffer[];
|
|
1228
1379
|
|
|
1229
1380
|
/**
|
|
1230
1381
|
* Synchronous readdir(3) - read a directory.
|
|
1231
1382
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1232
1383
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1233
1384
|
*/
|
|
1234
|
-
export function readdirSync(
|
|
1385
|
+
export function readdirSync(
|
|
1386
|
+
path: PathLike,
|
|
1387
|
+
options?: BaseEncodingOptions & { withFileTypes?: false | undefined } | BufferEncoding | null,
|
|
1388
|
+
): string[] | Buffer[];
|
|
1235
1389
|
|
|
1236
1390
|
/**
|
|
1237
1391
|
* Synchronous readdir(3) - read a directory.
|
|
@@ -1267,14 +1421,23 @@ declare module 'fs' {
|
|
|
1267
1421
|
* @param [flags='r'] See `support of file system `flags``.
|
|
1268
1422
|
* @param [mode=0o666]
|
|
1269
1423
|
*/
|
|
1270
|
-
export function open(
|
|
1424
|
+
export function open(
|
|
1425
|
+
path: PathLike,
|
|
1426
|
+
flags: OpenMode | undefined,
|
|
1427
|
+
mode: Mode | undefined | null,
|
|
1428
|
+
callback: (err: NodeJS.ErrnoException | null, fd: number) => void,
|
|
1429
|
+
): void;
|
|
1271
1430
|
|
|
1272
1431
|
/**
|
|
1273
1432
|
* Asynchronous open(2) - open and possibly create a file. If the file is created, its mode will be `0o666`.
|
|
1274
1433
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1275
1434
|
* @param [flags='r'] See `support of file system `flags``.
|
|
1276
1435
|
*/
|
|
1277
|
-
export function open(
|
|
1436
|
+
export function open(
|
|
1437
|
+
path: PathLike,
|
|
1438
|
+
flags: OpenMode | undefined,
|
|
1439
|
+
callback: (err: NodeJS.ErrnoException | null, fd: number) => void,
|
|
1440
|
+
): void;
|
|
1278
1441
|
|
|
1279
1442
|
/**
|
|
1280
1443
|
* Asynchronous open(2) - open and possibly create a file. If the file is created, its mode will be `0o666`.
|
|
@@ -1305,7 +1468,12 @@ declare module 'fs' {
|
|
|
1305
1468
|
* @param atime The last access time. If a string is provided, it will be coerced to number.
|
|
1306
1469
|
* @param mtime The last modified time. If a string is provided, it will be coerced to number.
|
|
1307
1470
|
*/
|
|
1308
|
-
export function utimes(
|
|
1471
|
+
export function utimes(
|
|
1472
|
+
path: PathLike,
|
|
1473
|
+
atime: string | number | Date,
|
|
1474
|
+
mtime: string | number | Date,
|
|
1475
|
+
callback: NoParamCallback,
|
|
1476
|
+
): void;
|
|
1309
1477
|
|
|
1310
1478
|
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
|
|
1311
1479
|
export namespace utimes {
|
|
@@ -1315,7 +1483,11 @@ declare module 'fs' {
|
|
|
1315
1483
|
* @param atime The last access time. If a string is provided, it will be coerced to number.
|
|
1316
1484
|
* @param mtime The last modified time. If a string is provided, it will be coerced to number.
|
|
1317
1485
|
*/
|
|
1318
|
-
function __promisify__(
|
|
1486
|
+
function __promisify__(
|
|
1487
|
+
path: PathLike,
|
|
1488
|
+
atime: string | number | Date,
|
|
1489
|
+
mtime: string | number | Date,
|
|
1490
|
+
): Promise<void>;
|
|
1319
1491
|
}
|
|
1320
1492
|
|
|
1321
1493
|
/**
|
|
@@ -1332,7 +1504,12 @@ declare module 'fs' {
|
|
|
1332
1504
|
* @param atime The last access time. If a string is provided, it will be coerced to number.
|
|
1333
1505
|
* @param mtime The last modified time. If a string is provided, it will be coerced to number.
|
|
1334
1506
|
*/
|
|
1335
|
-
export function futimes(
|
|
1507
|
+
export function futimes(
|
|
1508
|
+
fd: number,
|
|
1509
|
+
atime: string | number | Date,
|
|
1510
|
+
mtime: string | number | Date,
|
|
1511
|
+
callback: NoParamCallback,
|
|
1512
|
+
): void;
|
|
1336
1513
|
|
|
1337
1514
|
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
|
|
1338
1515
|
export namespace futimes {
|
|
@@ -1413,14 +1590,18 @@ declare module 'fs' {
|
|
|
1413
1590
|
fd: number,
|
|
1414
1591
|
buffer: TBuffer,
|
|
1415
1592
|
offset: number | undefined | null,
|
|
1416
|
-
callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void
|
|
1593
|
+
callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void,
|
|
1417
1594
|
): void;
|
|
1418
1595
|
|
|
1419
1596
|
/**
|
|
1420
1597
|
* Asynchronously writes `buffer` to the file referenced by the supplied file descriptor.
|
|
1421
1598
|
* @param fd A file descriptor.
|
|
1422
1599
|
*/
|
|
1423
|
-
export function write<TBuffer extends NodeJS.ArrayBufferView>(
|
|
1600
|
+
export function write<TBuffer extends NodeJS.ArrayBufferView>(
|
|
1601
|
+
fd: number,
|
|
1602
|
+
buffer: TBuffer,
|
|
1603
|
+
callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void,
|
|
1604
|
+
): void;
|
|
1424
1605
|
|
|
1425
1606
|
/**
|
|
1426
1607
|
* Asynchronously writes `string` to the file referenced by the supplied file descriptor.
|
|
@@ -1443,14 +1624,23 @@ declare module 'fs' {
|
|
|
1443
1624
|
* @param string A string to write.
|
|
1444
1625
|
* @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
|
|
1445
1626
|
*/
|
|
1446
|
-
export function write(
|
|
1627
|
+
export function write(
|
|
1628
|
+
fd: number,
|
|
1629
|
+
string: string,
|
|
1630
|
+
position: number | undefined | null,
|
|
1631
|
+
callback: (err: NodeJS.ErrnoException | null, written: number, str: string) => void,
|
|
1632
|
+
): void;
|
|
1447
1633
|
|
|
1448
1634
|
/**
|
|
1449
1635
|
* Asynchronously writes `string` to the file referenced by the supplied file descriptor.
|
|
1450
1636
|
* @param fd A file descriptor.
|
|
1451
1637
|
* @param string A string to write.
|
|
1452
1638
|
*/
|
|
1453
|
-
export function write(
|
|
1639
|
+
export function write(
|
|
1640
|
+
fd: number,
|
|
1641
|
+
string: string,
|
|
1642
|
+
callback: (err: NodeJS.ErrnoException | null, written: number, str: string) => void,
|
|
1643
|
+
): void;
|
|
1454
1644
|
|
|
1455
1645
|
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
|
|
1456
1646
|
export namespace write {
|
|
@@ -1467,7 +1657,7 @@ declare module 'fs' {
|
|
|
1467
1657
|
offset?: number,
|
|
1468
1658
|
length?: number,
|
|
1469
1659
|
position?: number | null,
|
|
1470
|
-
): Promise<{ bytesWritten: number
|
|
1660
|
+
): Promise<{ bytesWritten: number; buffer: TBuffer }>;
|
|
1471
1661
|
|
|
1472
1662
|
/**
|
|
1473
1663
|
* Asynchronously writes `string` to the file referenced by the supplied file descriptor.
|
|
@@ -1476,7 +1666,12 @@ declare module 'fs' {
|
|
|
1476
1666
|
* @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
|
|
1477
1667
|
* @param encoding The expected string encoding.
|
|
1478
1668
|
*/
|
|
1479
|
-
function __promisify__(
|
|
1669
|
+
function __promisify__(
|
|
1670
|
+
fd: number,
|
|
1671
|
+
string: string,
|
|
1672
|
+
position?: number | null,
|
|
1673
|
+
encoding?: BufferEncoding | null,
|
|
1674
|
+
): Promise<{ bytesWritten: number; buffer: string }>;
|
|
1480
1675
|
}
|
|
1481
1676
|
|
|
1482
1677
|
/**
|
|
@@ -1486,7 +1681,13 @@ declare module 'fs' {
|
|
|
1486
1681
|
* @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`.
|
|
1487
1682
|
* @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
|
|
1488
1683
|
*/
|
|
1489
|
-
export function writeSync(
|
|
1684
|
+
export function writeSync(
|
|
1685
|
+
fd: number,
|
|
1686
|
+
buffer: NodeJS.ArrayBufferView,
|
|
1687
|
+
offset?: number | null,
|
|
1688
|
+
length?: number | null,
|
|
1689
|
+
position?: number | null,
|
|
1690
|
+
): number;
|
|
1490
1691
|
|
|
1491
1692
|
/**
|
|
1492
1693
|
* Synchronously writes `string` to the file referenced by the supplied file descriptor, returning the number of bytes written.
|
|
@@ -1495,7 +1696,12 @@ declare module 'fs' {
|
|
|
1495
1696
|
* @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
|
|
1496
1697
|
* @param encoding The expected string encoding.
|
|
1497
1698
|
*/
|
|
1498
|
-
export function writeSync(
|
|
1699
|
+
export function writeSync(
|
|
1700
|
+
fd: number,
|
|
1701
|
+
string: string,
|
|
1702
|
+
position?: number | null,
|
|
1703
|
+
encoding?: BufferEncoding | null,
|
|
1704
|
+
): number;
|
|
1499
1705
|
|
|
1500
1706
|
/**
|
|
1501
1707
|
* Asynchronously reads data from the file referenced by the supplied file descriptor.
|
|
@@ -1528,8 +1734,8 @@ declare module 'fs' {
|
|
|
1528
1734
|
buffer: TBuffer,
|
|
1529
1735
|
offset: number,
|
|
1530
1736
|
length: number,
|
|
1531
|
-
position: number | null
|
|
1532
|
-
): Promise<{ bytesRead: number
|
|
1737
|
+
position: number | null,
|
|
1738
|
+
): Promise<{ bytesRead: number; buffer: TBuffer }>;
|
|
1533
1739
|
}
|
|
1534
1740
|
|
|
1535
1741
|
export interface ReadSyncOptions {
|
|
@@ -1555,7 +1761,13 @@ declare module 'fs' {
|
|
|
1555
1761
|
* @param length The number of bytes to read.
|
|
1556
1762
|
* @param position The offset from the beginning of the file from which data should be read. If `null`, data will be read from the current position.
|
|
1557
1763
|
*/
|
|
1558
|
-
export function readSync(
|
|
1764
|
+
export function readSync(
|
|
1765
|
+
fd: number,
|
|
1766
|
+
buffer: NodeJS.ArrayBufferView,
|
|
1767
|
+
offset: number,
|
|
1768
|
+
length: number,
|
|
1769
|
+
position: number | null,
|
|
1770
|
+
): number;
|
|
1559
1771
|
|
|
1560
1772
|
/**
|
|
1561
1773
|
* Similar to the above `fs.readSync` function, this version takes an optional `options` object.
|
|
@@ -1572,8 +1784,8 @@ declare module 'fs' {
|
|
|
1572
1784
|
*/
|
|
1573
1785
|
export function readFile(
|
|
1574
1786
|
path: PathLike | number,
|
|
1575
|
-
options: { encoding?: null | undefined; flag?: string | undefined
|
|
1576
|
-
callback: (err: NodeJS.ErrnoException | null, data: Buffer) => void
|
|
1787
|
+
options: { encoding?: null | undefined; flag?: string | undefined } | undefined | null,
|
|
1788
|
+
callback: (err: NodeJS.ErrnoException | null, data: Buffer) => void,
|
|
1577
1789
|
): void;
|
|
1578
1790
|
|
|
1579
1791
|
/**
|
|
@@ -1586,8 +1798,8 @@ declare module 'fs' {
|
|
|
1586
1798
|
*/
|
|
1587
1799
|
export function readFile(
|
|
1588
1800
|
path: PathLike | number,
|
|
1589
|
-
options: { encoding: BufferEncoding; flag?: string | undefined
|
|
1590
|
-
callback: (err: NodeJS.ErrnoException | null, data: string) => void
|
|
1801
|
+
options: { encoding: BufferEncoding; flag?: string | undefined } | BufferEncoding,
|
|
1802
|
+
callback: (err: NodeJS.ErrnoException | null, data: string) => void,
|
|
1591
1803
|
): void;
|
|
1592
1804
|
|
|
1593
1805
|
/**
|
|
@@ -1600,7 +1812,7 @@ declare module 'fs' {
|
|
|
1600
1812
|
*/
|
|
1601
1813
|
export function readFile(
|
|
1602
1814
|
path: PathLike | number,
|
|
1603
|
-
options: BaseEncodingOptions & { flag?: string | undefined
|
|
1815
|
+
options: BaseEncodingOptions & { flag?: string | undefined } | BufferEncoding | undefined | null,
|
|
1604
1816
|
callback: (err: NodeJS.ErrnoException | null, data: string | Buffer) => void,
|
|
1605
1817
|
): void;
|
|
1606
1818
|
|
|
@@ -1609,7 +1821,10 @@ declare module 'fs' {
|
|
|
1609
1821
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1610
1822
|
* If a file descriptor is provided, the underlying file will _not_ be closed automatically.
|
|
1611
1823
|
*/
|
|
1612
|
-
export function readFile(
|
|
1824
|
+
export function readFile(
|
|
1825
|
+
path: PathLike | number,
|
|
1826
|
+
callback: (err: NodeJS.ErrnoException | null, data: Buffer) => void,
|
|
1827
|
+
): void;
|
|
1613
1828
|
|
|
1614
1829
|
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
|
|
1615
1830
|
export namespace readFile {
|
|
@@ -1620,7 +1835,10 @@ declare module 'fs' {
|
|
|
1620
1835
|
* @param options An object that may contain an optional flag.
|
|
1621
1836
|
* If a flag is not provided, it defaults to `'r'`.
|
|
1622
1837
|
*/
|
|
1623
|
-
function __promisify__(
|
|
1838
|
+
function __promisify__(
|
|
1839
|
+
path: PathLike | number,
|
|
1840
|
+
options?: { encoding?: null | undefined; flag?: string | undefined } | null,
|
|
1841
|
+
): Promise<Buffer>;
|
|
1624
1842
|
|
|
1625
1843
|
/**
|
|
1626
1844
|
* Asynchronously reads the entire contents of a file.
|
|
@@ -1630,7 +1848,10 @@ declare module 'fs' {
|
|
|
1630
1848
|
* @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
|
|
1631
1849
|
* If a flag is not provided, it defaults to `'r'`.
|
|
1632
1850
|
*/
|
|
1633
|
-
function __promisify__(
|
|
1851
|
+
function __promisify__(
|
|
1852
|
+
path: PathLike | number,
|
|
1853
|
+
options: { encoding: BufferEncoding; flag?: string | undefined } | BufferEncoding,
|
|
1854
|
+
): Promise<string>;
|
|
1634
1855
|
|
|
1635
1856
|
/**
|
|
1636
1857
|
* Asynchronously reads the entire contents of a file.
|
|
@@ -1640,7 +1861,10 @@ declare module 'fs' {
|
|
|
1640
1861
|
* @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
|
|
1641
1862
|
* If a flag is not provided, it defaults to `'r'`.
|
|
1642
1863
|
*/
|
|
1643
|
-
function __promisify__(
|
|
1864
|
+
function __promisify__(
|
|
1865
|
+
path: PathLike | number,
|
|
1866
|
+
options?: BaseEncodingOptions & { flag?: string | undefined } | BufferEncoding | null,
|
|
1867
|
+
): Promise<string | Buffer>;
|
|
1644
1868
|
}
|
|
1645
1869
|
|
|
1646
1870
|
/**
|
|
@@ -1650,7 +1874,10 @@ declare module 'fs' {
|
|
|
1650
1874
|
* If a file descriptor is provided, the underlying file will _not_ be closed automatically.
|
|
1651
1875
|
* @param options An object that may contain an optional flag. If a flag is not provided, it defaults to `'r'`.
|
|
1652
1876
|
*/
|
|
1653
|
-
export function readFileSync(
|
|
1877
|
+
export function readFileSync(
|
|
1878
|
+
path: PathLike | number,
|
|
1879
|
+
options?: { encoding?: null | undefined; flag?: string | undefined } | null,
|
|
1880
|
+
): Buffer;
|
|
1654
1881
|
|
|
1655
1882
|
/**
|
|
1656
1883
|
* Synchronously reads the entire contents of a file.
|
|
@@ -1660,7 +1887,10 @@ declare module 'fs' {
|
|
|
1660
1887
|
* @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
|
|
1661
1888
|
* If a flag is not provided, it defaults to `'r'`.
|
|
1662
1889
|
*/
|
|
1663
|
-
export function readFileSync(
|
|
1890
|
+
export function readFileSync(
|
|
1891
|
+
path: PathLike | number,
|
|
1892
|
+
options: { encoding: BufferEncoding; flag?: string | undefined } | BufferEncoding,
|
|
1893
|
+
): string;
|
|
1664
1894
|
|
|
1665
1895
|
/**
|
|
1666
1896
|
* Synchronously reads the entire contents of a file.
|
|
@@ -1670,9 +1900,15 @@ declare module 'fs' {
|
|
|
1670
1900
|
* @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
|
|
1671
1901
|
* If a flag is not provided, it defaults to `'r'`.
|
|
1672
1902
|
*/
|
|
1673
|
-
export function readFileSync(
|
|
1903
|
+
export function readFileSync(
|
|
1904
|
+
path: PathLike | number,
|
|
1905
|
+
options?: BaseEncodingOptions & { flag?: string | undefined } | BufferEncoding | null,
|
|
1906
|
+
): string | Buffer;
|
|
1674
1907
|
|
|
1675
|
-
export type WriteFileOptions =
|
|
1908
|
+
export type WriteFileOptions =
|
|
1909
|
+
| BaseEncodingOptions & { mode?: Mode | undefined; flag?: string | undefined }
|
|
1910
|
+
| BufferEncoding
|
|
1911
|
+
| null;
|
|
1676
1912
|
|
|
1677
1913
|
/**
|
|
1678
1914
|
* Asynchronously writes data to a file, replacing the file if it already exists.
|
|
@@ -1686,7 +1922,12 @@ declare module 'fs' {
|
|
|
1686
1922
|
* If `mode` is a string, it is parsed as an octal integer.
|
|
1687
1923
|
* If `flag` is not supplied, the default of `'w'` is used.
|
|
1688
1924
|
*/
|
|
1689
|
-
export function writeFile(
|
|
1925
|
+
export function writeFile(
|
|
1926
|
+
path: PathLike | number,
|
|
1927
|
+
data: string | NodeJS.ArrayBufferView,
|
|
1928
|
+
options: WriteFileOptions,
|
|
1929
|
+
callback: NoParamCallback,
|
|
1930
|
+
): void;
|
|
1690
1931
|
|
|
1691
1932
|
/**
|
|
1692
1933
|
* Asynchronously writes data to a file, replacing the file if it already exists.
|
|
@@ -1695,7 +1936,11 @@ declare module 'fs' {
|
|
|
1695
1936
|
* If a file descriptor is provided, the underlying file will _not_ be closed automatically.
|
|
1696
1937
|
* @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string.
|
|
1697
1938
|
*/
|
|
1698
|
-
export function writeFile(
|
|
1939
|
+
export function writeFile(
|
|
1940
|
+
path: PathLike | number,
|
|
1941
|
+
data: string | NodeJS.ArrayBufferView,
|
|
1942
|
+
callback: NoParamCallback,
|
|
1943
|
+
): void;
|
|
1699
1944
|
|
|
1700
1945
|
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
|
|
1701
1946
|
export namespace writeFile {
|
|
@@ -1711,7 +1956,11 @@ declare module 'fs' {
|
|
|
1711
1956
|
* If `mode` is a string, it is parsed as an octal integer.
|
|
1712
1957
|
* If `flag` is not supplied, the default of `'w'` is used.
|
|
1713
1958
|
*/
|
|
1714
|
-
function __promisify__(
|
|
1959
|
+
function __promisify__(
|
|
1960
|
+
path: PathLike | number,
|
|
1961
|
+
data: string | NodeJS.ArrayBufferView,
|
|
1962
|
+
options?: WriteFileOptions,
|
|
1963
|
+
): Promise<void>;
|
|
1715
1964
|
}
|
|
1716
1965
|
|
|
1717
1966
|
/**
|
|
@@ -1726,7 +1975,11 @@ declare module 'fs' {
|
|
|
1726
1975
|
* If `mode` is a string, it is parsed as an octal integer.
|
|
1727
1976
|
* If `flag` is not supplied, the default of `'w'` is used.
|
|
1728
1977
|
*/
|
|
1729
|
-
export function writeFileSync(
|
|
1978
|
+
export function writeFileSync(
|
|
1979
|
+
path: PathLike | number,
|
|
1980
|
+
data: string | NodeJS.ArrayBufferView,
|
|
1981
|
+
options?: WriteFileOptions,
|
|
1982
|
+
): void;
|
|
1730
1983
|
|
|
1731
1984
|
/**
|
|
1732
1985
|
* Asynchronously append data to a file, creating the file if it does not exist.
|
|
@@ -1740,7 +1993,12 @@ declare module 'fs' {
|
|
|
1740
1993
|
* If `mode` is a string, it is parsed as an octal integer.
|
|
1741
1994
|
* If `flag` is not supplied, the default of `'a'` is used.
|
|
1742
1995
|
*/
|
|
1743
|
-
export function appendFile(
|
|
1996
|
+
export function appendFile(
|
|
1997
|
+
file: PathLike | number,
|
|
1998
|
+
data: string | Uint8Array,
|
|
1999
|
+
options: WriteFileOptions,
|
|
2000
|
+
callback: NoParamCallback,
|
|
2001
|
+
): void;
|
|
1744
2002
|
|
|
1745
2003
|
/**
|
|
1746
2004
|
* Asynchronously append data to a file, creating the file if it does not exist.
|
|
@@ -1765,7 +2023,11 @@ declare module 'fs' {
|
|
|
1765
2023
|
* If `mode` is a string, it is parsed as an octal integer.
|
|
1766
2024
|
* If `flag` is not supplied, the default of `'a'` is used.
|
|
1767
2025
|
*/
|
|
1768
|
-
function __promisify__(
|
|
2026
|
+
function __promisify__(
|
|
2027
|
+
file: PathLike | number,
|
|
2028
|
+
data: string | Uint8Array,
|
|
2029
|
+
options?: WriteFileOptions,
|
|
2030
|
+
): Promise<void>;
|
|
1769
2031
|
}
|
|
1770
2032
|
|
|
1771
2033
|
/**
|
|
@@ -1780,12 +2042,20 @@ declare module 'fs' {
|
|
|
1780
2042
|
* If `mode` is a string, it is parsed as an octal integer.
|
|
1781
2043
|
* If `flag` is not supplied, the default of `'a'` is used.
|
|
1782
2044
|
*/
|
|
1783
|
-
export function appendFileSync(
|
|
2045
|
+
export function appendFileSync(
|
|
2046
|
+
file: PathLike | number,
|
|
2047
|
+
data: string | Uint8Array,
|
|
2048
|
+
options?: WriteFileOptions,
|
|
2049
|
+
): void;
|
|
1784
2050
|
|
|
1785
2051
|
/**
|
|
1786
2052
|
* Watch for changes on `filename`. The callback `listener` will be called each time the file is accessed.
|
|
1787
2053
|
*/
|
|
1788
|
-
export function watchFile(
|
|
2054
|
+
export function watchFile(
|
|
2055
|
+
filename: PathLike,
|
|
2056
|
+
options: { persistent?: boolean | undefined; interval?: number | undefined } | undefined,
|
|
2057
|
+
listener: (curr: Stats, prev: Stats) => void,
|
|
2058
|
+
): void;
|
|
1789
2059
|
|
|
1790
2060
|
/**
|
|
1791
2061
|
* Watch for changes on `filename`. The callback `listener` will be called each time the file is accessed.
|
|
@@ -1812,7 +2082,15 @@ declare module 'fs' {
|
|
|
1812
2082
|
*/
|
|
1813
2083
|
export function watch(
|
|
1814
2084
|
filename: PathLike,
|
|
1815
|
-
options:
|
|
2085
|
+
options:
|
|
2086
|
+
| {
|
|
2087
|
+
encoding?: BufferEncoding | null | undefined;
|
|
2088
|
+
persistent?: boolean | undefined;
|
|
2089
|
+
recursive?: boolean | undefined;
|
|
2090
|
+
}
|
|
2091
|
+
| BufferEncoding
|
|
2092
|
+
| undefined
|
|
2093
|
+
| null,
|
|
1816
2094
|
listener?: (event: "rename" | "change", filename: string) => void,
|
|
1817
2095
|
): FSWatcher;
|
|
1818
2096
|
|
|
@@ -1827,8 +2105,8 @@ declare module 'fs' {
|
|
|
1827
2105
|
*/
|
|
1828
2106
|
export function watch(
|
|
1829
2107
|
filename: PathLike,
|
|
1830
|
-
options: { encoding: "buffer"
|
|
1831
|
-
listener?: (event: "rename" | "change", filename: Buffer) => void
|
|
2108
|
+
options: { encoding: "buffer"; persistent?: boolean | undefined; recursive?: boolean | undefined } | "buffer",
|
|
2109
|
+
listener?: (event: "rename" | "change", filename: Buffer) => void,
|
|
1832
2110
|
): FSWatcher;
|
|
1833
2111
|
|
|
1834
2112
|
/**
|
|
@@ -1842,7 +2120,14 @@ declare module 'fs' {
|
|
|
1842
2120
|
*/
|
|
1843
2121
|
export function watch(
|
|
1844
2122
|
filename: PathLike,
|
|
1845
|
-
options:
|
|
2123
|
+
options:
|
|
2124
|
+
| {
|
|
2125
|
+
encoding?: BufferEncoding | null | undefined;
|
|
2126
|
+
persistent?: boolean | undefined;
|
|
2127
|
+
recursive?: boolean | undefined;
|
|
2128
|
+
}
|
|
2129
|
+
| string
|
|
2130
|
+
| null,
|
|
1846
2131
|
listener?: (event: "rename" | "change", filename: string | Buffer) => void,
|
|
1847
2132
|
): FSWatcher;
|
|
1848
2133
|
|
|
@@ -1851,7 +2136,10 @@ declare module 'fs' {
|
|
|
1851
2136
|
* @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
|
|
1852
2137
|
* URL support is _experimental_.
|
|
1853
2138
|
*/
|
|
1854
|
-
export function watch(
|
|
2139
|
+
export function watch(
|
|
2140
|
+
filename: PathLike,
|
|
2141
|
+
listener?: (event: "rename" | "change", filename: string) => any,
|
|
2142
|
+
): FSWatcher;
|
|
1855
2143
|
|
|
1856
2144
|
/**
|
|
1857
2145
|
* Asynchronously tests whether or not the given path exists by checking with the file system.
|
|
@@ -2195,13 +2483,13 @@ declare module 'fs' {
|
|
|
2195
2483
|
export function writev(
|
|
2196
2484
|
fd: number,
|
|
2197
2485
|
buffers: ReadonlyArray<NodeJS.ArrayBufferView>,
|
|
2198
|
-
cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers: NodeJS.ArrayBufferView[]) => void
|
|
2486
|
+
cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers: NodeJS.ArrayBufferView[]) => void,
|
|
2199
2487
|
): void;
|
|
2200
2488
|
export function writev(
|
|
2201
2489
|
fd: number,
|
|
2202
2490
|
buffers: ReadonlyArray<NodeJS.ArrayBufferView>,
|
|
2203
2491
|
position: number,
|
|
2204
|
-
cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers: NodeJS.ArrayBufferView[]) => void
|
|
2492
|
+
cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers: NodeJS.ArrayBufferView[]) => void,
|
|
2205
2493
|
): void;
|
|
2206
2494
|
|
|
2207
2495
|
export interface WriteVResult {
|
|
@@ -2210,7 +2498,11 @@ declare module 'fs' {
|
|
|
2210
2498
|
}
|
|
2211
2499
|
|
|
2212
2500
|
export namespace writev {
|
|
2213
|
-
function __promisify__(
|
|
2501
|
+
function __promisify__(
|
|
2502
|
+
fd: number,
|
|
2503
|
+
buffers: ReadonlyArray<NodeJS.ArrayBufferView>,
|
|
2504
|
+
position?: number,
|
|
2505
|
+
): Promise<WriteVResult>;
|
|
2214
2506
|
}
|
|
2215
2507
|
|
|
2216
2508
|
/**
|
|
@@ -2221,13 +2513,13 @@ declare module 'fs' {
|
|
|
2221
2513
|
export function readv(
|
|
2222
2514
|
fd: number,
|
|
2223
2515
|
buffers: ReadonlyArray<NodeJS.ArrayBufferView>,
|
|
2224
|
-
cb: (err: NodeJS.ErrnoException | null, bytesRead: number, buffers: NodeJS.ArrayBufferView[]) => void
|
|
2516
|
+
cb: (err: NodeJS.ErrnoException | null, bytesRead: number, buffers: NodeJS.ArrayBufferView[]) => void,
|
|
2225
2517
|
): void;
|
|
2226
2518
|
export function readv(
|
|
2227
2519
|
fd: number,
|
|
2228
2520
|
buffers: ReadonlyArray<NodeJS.ArrayBufferView>,
|
|
2229
2521
|
position: number,
|
|
2230
|
-
cb: (err: NodeJS.ErrnoException | null, bytesRead: number, buffers: NodeJS.ArrayBufferView[]) => void
|
|
2522
|
+
cb: (err: NodeJS.ErrnoException | null, bytesRead: number, buffers: NodeJS.ArrayBufferView[]) => void,
|
|
2231
2523
|
): void;
|
|
2232
2524
|
|
|
2233
2525
|
export interface ReadVResult {
|
|
@@ -2236,7 +2528,11 @@ declare module 'fs' {
|
|
|
2236
2528
|
}
|
|
2237
2529
|
|
|
2238
2530
|
export namespace readv {
|
|
2239
|
-
function __promisify__(
|
|
2531
|
+
function __promisify__(
|
|
2532
|
+
fd: number,
|
|
2533
|
+
buffers: ReadonlyArray<NodeJS.ArrayBufferView>,
|
|
2534
|
+
position?: number,
|
|
2535
|
+
): Promise<ReadVResult>;
|
|
2240
2536
|
}
|
|
2241
2537
|
|
|
2242
2538
|
/**
|
|
@@ -2258,7 +2554,11 @@ declare module 'fs' {
|
|
|
2258
2554
|
export function opendirSync(path: PathLike, options?: OpenDirOptions): Dir;
|
|
2259
2555
|
|
|
2260
2556
|
export function opendir(path: PathLike, cb: (err: NodeJS.ErrnoException | null, dir: Dir) => void): void;
|
|
2261
|
-
export function opendir(
|
|
2557
|
+
export function opendir(
|
|
2558
|
+
path: PathLike,
|
|
2559
|
+
options: OpenDirOptions,
|
|
2560
|
+
cb: (err: NodeJS.ErrnoException | null, dir: Dir) => void,
|
|
2561
|
+
): void;
|
|
2262
2562
|
|
|
2263
2563
|
export namespace opendir {
|
|
2264
2564
|
function __promisify__(path: PathLike, options?: OpenDirOptions): Promise<Dir>;
|
|
@@ -2282,6 +2582,6 @@ declare module 'fs' {
|
|
|
2282
2582
|
bigint?: boolean | undefined;
|
|
2283
2583
|
}
|
|
2284
2584
|
}
|
|
2285
|
-
declare module
|
|
2286
|
-
export * from
|
|
2585
|
+
declare module "node:fs" {
|
|
2586
|
+
export * from "fs";
|
|
2287
2587
|
}
|