@types/node 15.14.7 → 16.0.1
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 v15.14 → node}/LICENSE +0 -0
- node v15.14/README.md → node/README.md +3 -3
- node/assert/strict.d.ts +9 -0
- node v15.14/assert.d.ts → node/assert.d.ts +35 -30
- node v15.14/async_hooks.d.ts → node/async_hooks.d.ts +7 -3
- {node v15.14 → node}/base.d.ts +0 -0
- node/buffer.d.ts +357 -0
- node v15.14/child_process.d.ts → node/child_process.d.ts +54 -50
- node v15.14/cluster.d.ts → node/cluster.d.ts +33 -108
- node v15.14/console.d.ts → node/console.d.ts +24 -23
- node v15.14/constants.d.ts → node/constants.d.ts +5 -0
- node v15.14/crypto.d.ts → node/crypto.d.ts +82 -67
- node v15.14/dgram.d.ts → node/dgram.d.ts +13 -9
- node v15.14/diagnostic_channel.d.ts → node/diagnostic_channel.d.ts +4 -0
- node v15.14/dns/promises.d.ts → node/dns/promises.d.ts +4 -0
- node v15.14/dns.d.ts → node/dns.d.ts +15 -11
- node/domain.d.ts +25 -0
- node v15.14/events.d.ts → node/events.d.ts +8 -3
- node v15.14/fs/promises.d.ts → node/fs/promises.d.ts +25 -17
- node v15.14/fs.d.ts → node/fs.d.ts +71 -75
- node/globals.d.ts +274 -0
- node/globals.global.d.ts +1 -0
- node v15.14/http.d.ts → node/http.d.ts +109 -167
- node v15.14/http2.d.ts → node/http2.d.ts +69 -66
- node/https.d.ts +40 -0
- node v15.14/index.d.ts → node/index.d.ts +1 -1
- node v15.14/inspector.d.ts → node/inspector.d.ts +152 -470
- node v15.14/module.d.ts → node/module.d.ts +25 -4
- node v15.14/net.d.ts → node/net.d.ts +34 -36
- node v15.14/os.d.ts → node/os.d.ts +4 -0
- node v15.14/package.json → node/package.json +2 -2
- node v15.14/path.d.ts → node/path.d.ts +10 -5
- node v15.14/perf_hooks.d.ts → node/perf_hooks.d.ts +70 -23
- node v15.14/process.d.ts → node/process.d.ts +54 -51
- node v15.14/punycode.d.ts → node/punycode.d.ts +4 -0
- node v15.14/querystring.d.ts → node/querystring.d.ts +7 -3
- node v15.14/readline.d.ts → node/readline.d.ts +20 -16
- node v15.14/repl.d.ts → node/repl.d.ts +18 -14
- node v15.14/stream/promises.d.ts → node/stream/promises.d.ts +4 -0
- node v15.14/stream.d.ts → node/stream.d.ts +22 -17
- node v15.14/string_decoder.d.ts → node/string_decoder.d.ts +4 -0
- node v15.14/timers/promises.d.ts → node/timers/promises.d.ts +4 -0
- node/timers.d.ts +92 -0
- node v15.14/tls.d.ts → node/tls.d.ts +54 -50
- node v15.14/trace_events.d.ts → node/trace_events.d.ts +4 -0
- node v15.14/ts3.6/assert.d.ts → node/ts3.6/assert.d.ts +26 -26
- {node v15.14 → node}/ts3.6/base.d.ts +0 -0
- {node v15.14 → node}/ts3.6/index.d.ts +0 -0
- node v15.14/tty.d.ts → node/tty.d.ts +4 -0
- node v15.14/url.d.ts → node/url.d.ts +19 -15
- node/util/types.d.ts +57 -0
- node v15.14/util.d.ts → node/util.d.ts +67 -21
- node v15.14/v8.d.ts → node/v8.d.ts +4 -0
- node v15.14/vm.d.ts → node/vm.d.ts +28 -24
- node v15.14/wasi.d.ts → node/wasi.d.ts +11 -7
- node v15.14/worker_threads.d.ts → node/worker_threads.d.ts +19 -15
- node v15.14/zlib.d.ts → node/zlib.d.ts +20 -16
- node v15.14/assert/strict.d.ts +0 -4
- node v15.14/buffer.d.ts +0 -112
- node v15.14/domain.d.ts +0 -24
- node v15.14/globals.d.ts +0 -659
- node v15.14/globals.global.d.ts +0 -1
- node v15.14/https.d.ts +0 -139
- node v15.14/timers.d.ts +0 -27
- node v15.14/util/types.d.ts +0 -53
|
@@ -15,7 +15,7 @@ declare module 'fs' {
|
|
|
15
15
|
export type BufferEncodingOption = 'buffer' | { encoding: 'buffer' };
|
|
16
16
|
|
|
17
17
|
export interface BaseEncodingOptions {
|
|
18
|
-
encoding?: BufferEncoding | null;
|
|
18
|
+
encoding?: BufferEncoding | null | undefined;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
export type OpenMode = number | string;
|
|
@@ -532,7 +532,7 @@ declare module 'fs' {
|
|
|
532
532
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
533
533
|
*/
|
|
534
534
|
export function stat(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
|
|
535
|
-
export function stat(path: PathLike, options: StatOptions & { bigint?: false } | undefined, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
|
|
535
|
+
export function stat(path: PathLike, options: StatOptions & { bigint?: false | undefined } | undefined, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
|
|
536
536
|
export function stat(path: PathLike, options: StatOptions & { bigint: true }, callback: (err: NodeJS.ErrnoException | null, stats: BigIntStats) => void): void;
|
|
537
537
|
export function stat(path: PathLike, options: StatOptions | undefined, callback: (err: NodeJS.ErrnoException | null, stats: Stats | BigIntStats) => void): void;
|
|
538
538
|
|
|
@@ -542,18 +542,18 @@ declare module 'fs' {
|
|
|
542
542
|
* Asynchronous stat(2) - Get file status.
|
|
543
543
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
544
544
|
*/
|
|
545
|
-
function __promisify__(path: PathLike, options?: StatOptions & { bigint?: false }): Promise<Stats>;
|
|
545
|
+
function __promisify__(path: PathLike, options?: StatOptions & { bigint?: false | undefined }): Promise<Stats>;
|
|
546
546
|
function __promisify__(path: PathLike, options: StatOptions & { bigint: true }): Promise<BigIntStats>;
|
|
547
547
|
function __promisify__(path: PathLike, options?: StatOptions): Promise<Stats | BigIntStats>;
|
|
548
548
|
}
|
|
549
549
|
|
|
550
550
|
export interface StatSyncFn<TDescriptor = PathLike> extends Function {
|
|
551
551
|
(path: TDescriptor, options?: undefined): Stats;
|
|
552
|
-
(path: TDescriptor, options?: StatOptions & { bigint?: false; throwIfNoEntry: false }): Stats | undefined;
|
|
552
|
+
(path: TDescriptor, options?: StatOptions & { bigint?: false | undefined; throwIfNoEntry: false }): Stats | undefined;
|
|
553
553
|
(path: TDescriptor, options: StatOptions & { bigint: true; throwIfNoEntry: false }): BigIntStats | undefined;
|
|
554
|
-
(path: TDescriptor, options?: StatOptions & { bigint?: false }): Stats;
|
|
554
|
+
(path: TDescriptor, options?: StatOptions & { bigint?: false | undefined }): Stats;
|
|
555
555
|
(path: TDescriptor, options: StatOptions & { bigint: true }): BigIntStats;
|
|
556
|
-
(path: TDescriptor, options: StatOptions & { bigint: boolean; throwIfNoEntry?: false }): Stats | BigIntStats;
|
|
556
|
+
(path: TDescriptor, options: StatOptions & { bigint: boolean; throwIfNoEntry?: false | undefined }): Stats | BigIntStats;
|
|
557
557
|
(path: TDescriptor, options?: StatOptions): Stats | BigIntStats | undefined;
|
|
558
558
|
}
|
|
559
559
|
|
|
@@ -568,7 +568,7 @@ declare module 'fs' {
|
|
|
568
568
|
* @param fd A file descriptor.
|
|
569
569
|
*/
|
|
570
570
|
export function fstat(fd: number, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
|
|
571
|
-
export function fstat(fd: number, options: StatOptions & { bigint?: false } | undefined, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
|
|
571
|
+
export function fstat(fd: number, options: StatOptions & { bigint?: false | undefined } | undefined, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
|
|
572
572
|
export function fstat(fd: number, options: StatOptions & { bigint: true }, callback: (err: NodeJS.ErrnoException | null, stats: BigIntStats) => void): void;
|
|
573
573
|
export function fstat(fd: number, options: StatOptions | undefined, callback: (err: NodeJS.ErrnoException | null, stats: Stats | BigIntStats) => void): void;
|
|
574
574
|
|
|
@@ -578,7 +578,7 @@ declare module 'fs' {
|
|
|
578
578
|
* Asynchronous fstat(2) - Get file status.
|
|
579
579
|
* @param fd A file descriptor.
|
|
580
580
|
*/
|
|
581
|
-
function __promisify__(fd: number, options?: StatOptions & { bigint?: false }): Promise<Stats>;
|
|
581
|
+
function __promisify__(fd: number, options?: StatOptions & { bigint?: false | undefined }): Promise<Stats>;
|
|
582
582
|
function __promisify__(fd: number, options: StatOptions & { bigint: true }): Promise<BigIntStats>;
|
|
583
583
|
function __promisify__(fd: number, options?: StatOptions): Promise<Stats | BigIntStats>;
|
|
584
584
|
}
|
|
@@ -594,7 +594,7 @@ declare module 'fs' {
|
|
|
594
594
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
595
595
|
*/
|
|
596
596
|
export function lstat(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
|
|
597
|
-
export function lstat(path: PathLike, options: StatOptions & { bigint?: false } | undefined, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
|
|
597
|
+
export function lstat(path: PathLike, options: StatOptions & { bigint?: false | undefined } | undefined, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
|
|
598
598
|
export function lstat(path: PathLike, options: StatOptions & { bigint: true }, callback: (err: NodeJS.ErrnoException | null, stats: BigIntStats) => void): void;
|
|
599
599
|
export function lstat(path: PathLike, options: StatOptions | undefined, callback: (err: NodeJS.ErrnoException | null, stats: Stats | BigIntStats) => void): void;
|
|
600
600
|
|
|
@@ -604,7 +604,7 @@ declare module 'fs' {
|
|
|
604
604
|
* Asynchronous lstat(2) - Get file status. Does not dereference symbolic links.
|
|
605
605
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
606
606
|
*/
|
|
607
|
-
function __promisify__(path: PathLike, options?: StatOptions & { bigint?: false }): Promise<Stats>;
|
|
607
|
+
function __promisify__(path: PathLike, options?: StatOptions & { bigint?: false | undefined }): Promise<Stats>;
|
|
608
608
|
function __promisify__(path: PathLike, options: StatOptions & { bigint: true }): Promise<BigIntStats>;
|
|
609
609
|
function __promisify__(path: PathLike, options?: StatOptions): Promise<Stats | BigIntStats>;
|
|
610
610
|
}
|
|
@@ -874,24 +874,13 @@ declare module 'fs' {
|
|
|
874
874
|
* `true`.
|
|
875
875
|
* @default 0
|
|
876
876
|
*/
|
|
877
|
-
maxRetries?: number;
|
|
878
|
-
/**
|
|
879
|
-
* @deprecated since v14.14.0 In future versions of Node.js,
|
|
880
|
-
* `fs.rmdir(path, { recursive: true })` will throw if `path` does not exist or is a file.
|
|
881
|
-
* Use `fs.rm(path, { recursive: true, force: true })` instead.
|
|
882
|
-
*
|
|
883
|
-
* If `true`, perform a recursive directory removal. In
|
|
884
|
-
* recursive mode, errors are not reported if `path` does not exist, and
|
|
885
|
-
* operations are retried on failure.
|
|
886
|
-
* @default false
|
|
887
|
-
*/
|
|
888
|
-
recursive?: boolean;
|
|
877
|
+
maxRetries?: number | undefined;
|
|
889
878
|
/**
|
|
890
879
|
* The amount of time in milliseconds to wait between retries.
|
|
891
880
|
* This option is ignored if the `recursive` option is not `true`.
|
|
892
881
|
* @default 100
|
|
893
882
|
*/
|
|
894
|
-
retryDelay?: number;
|
|
883
|
+
retryDelay?: number | undefined;
|
|
895
884
|
}
|
|
896
885
|
|
|
897
886
|
/**
|
|
@@ -921,7 +910,7 @@ declare module 'fs' {
|
|
|
921
910
|
* When `true`, exceptions will be ignored if `path` does not exist.
|
|
922
911
|
* @default false
|
|
923
912
|
*/
|
|
924
|
-
force?: boolean;
|
|
913
|
+
force?: boolean | undefined;
|
|
925
914
|
/**
|
|
926
915
|
* If an `EBUSY`, `EMFILE`, `ENFILE`, `ENOTEMPTY`, or
|
|
927
916
|
* `EPERM` error is encountered, Node.js will retry the operation with a linear
|
|
@@ -930,20 +919,19 @@ declare module 'fs' {
|
|
|
930
919
|
* `true`.
|
|
931
920
|
* @default 0
|
|
932
921
|
*/
|
|
933
|
-
maxRetries?: number;
|
|
922
|
+
maxRetries?: number | undefined;
|
|
934
923
|
/**
|
|
935
924
|
* If `true`, perform a recursive directory removal. In
|
|
936
|
-
* recursive mode,
|
|
937
|
-
* operations are retried on failure.
|
|
925
|
+
* recursive mode, operations are retried on failure.
|
|
938
926
|
* @default false
|
|
939
927
|
*/
|
|
940
|
-
recursive?: boolean;
|
|
928
|
+
recursive?: boolean | undefined;
|
|
941
929
|
/**
|
|
942
930
|
* The amount of time in milliseconds to wait between retries.
|
|
943
931
|
* This option is ignored if the `recursive` option is not `true`.
|
|
944
932
|
* @default 100
|
|
945
933
|
*/
|
|
946
|
-
retryDelay?: number;
|
|
934
|
+
retryDelay?: number | undefined;
|
|
947
935
|
}
|
|
948
936
|
|
|
949
937
|
/**
|
|
@@ -971,12 +959,12 @@ declare module 'fs' {
|
|
|
971
959
|
* If a folder was created, the path to the first created folder will be returned.
|
|
972
960
|
* @default false
|
|
973
961
|
*/
|
|
974
|
-
recursive?: boolean;
|
|
962
|
+
recursive?: boolean | undefined;
|
|
975
963
|
/**
|
|
976
964
|
* A file mode. If a string is passed, it is parsed as an octal integer. If not specified
|
|
977
965
|
* @default 0o777
|
|
978
966
|
*/
|
|
979
|
-
mode?: Mode;
|
|
967
|
+
mode?: Mode | undefined;
|
|
980
968
|
}
|
|
981
969
|
|
|
982
970
|
/**
|
|
@@ -993,7 +981,7 @@ declare module 'fs' {
|
|
|
993
981
|
* @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
|
|
994
982
|
* should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
|
|
995
983
|
*/
|
|
996
|
-
export function mkdir(path: PathLike, options: Mode | (MakeDirectoryOptions & { recursive?: false; }) | null | undefined, callback: NoParamCallback): void;
|
|
984
|
+
export function mkdir(path: PathLike, options: Mode | (MakeDirectoryOptions & { recursive?: false | undefined; }) | null | undefined, callback: NoParamCallback): void;
|
|
997
985
|
|
|
998
986
|
/**
|
|
999
987
|
* Asynchronous mkdir(2) - create a directory.
|
|
@@ -1025,7 +1013,7 @@ declare module 'fs' {
|
|
|
1025
1013
|
* @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
|
|
1026
1014
|
* should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
|
|
1027
1015
|
*/
|
|
1028
|
-
function __promisify__(path: PathLike, options?: Mode | (MakeDirectoryOptions & { recursive?: false; }) | null): Promise<void>;
|
|
1016
|
+
function __promisify__(path: PathLike, options?: Mode | (MakeDirectoryOptions & { recursive?: false | undefined; }) | null): Promise<void>;
|
|
1029
1017
|
|
|
1030
1018
|
/**
|
|
1031
1019
|
* Asynchronous mkdir(2) - create a directory.
|
|
@@ -1050,7 +1038,7 @@ declare module 'fs' {
|
|
|
1050
1038
|
* @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
|
|
1051
1039
|
* should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
|
|
1052
1040
|
*/
|
|
1053
|
-
export function mkdirSync(path: PathLike, options?: Mode | (MakeDirectoryOptions & { recursive?: false; }) | null): void;
|
|
1041
|
+
export function mkdirSync(path: PathLike, options?: Mode | (MakeDirectoryOptions & { recursive?: false | undefined; }) | null): void;
|
|
1054
1042
|
|
|
1055
1043
|
/**
|
|
1056
1044
|
* Synchronous mkdir(2) - create a directory.
|
|
@@ -1139,7 +1127,7 @@ declare module 'fs' {
|
|
|
1139
1127
|
*/
|
|
1140
1128
|
export function readdir(
|
|
1141
1129
|
path: PathLike,
|
|
1142
|
-
options: { encoding: BufferEncoding | null; withFileTypes?: false } | BufferEncoding | undefined | null,
|
|
1130
|
+
options: { encoding: BufferEncoding | null; withFileTypes?: false | undefined } | BufferEncoding | undefined | null,
|
|
1143
1131
|
callback: (err: NodeJS.ErrnoException | null, files: string[]) => void,
|
|
1144
1132
|
): void;
|
|
1145
1133
|
|
|
@@ -1148,7 +1136,11 @@ declare module 'fs' {
|
|
|
1148
1136
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1149
1137
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1150
1138
|
*/
|
|
1151
|
-
export function readdir(
|
|
1139
|
+
export function readdir(
|
|
1140
|
+
path: PathLike,
|
|
1141
|
+
options: { encoding: "buffer"; withFileTypes?: false | undefined } | "buffer",
|
|
1142
|
+
callback: (err: NodeJS.ErrnoException | null, files: Buffer[]) => void
|
|
1143
|
+
): void;
|
|
1152
1144
|
|
|
1153
1145
|
/**
|
|
1154
1146
|
* Asynchronous readdir(3) - read a directory.
|
|
@@ -1157,7 +1149,7 @@ declare module 'fs' {
|
|
|
1157
1149
|
*/
|
|
1158
1150
|
export function readdir(
|
|
1159
1151
|
path: PathLike,
|
|
1160
|
-
options: BaseEncodingOptions & { withFileTypes?: false } | BufferEncoding | undefined | null,
|
|
1152
|
+
options: BaseEncodingOptions & { withFileTypes?: false | undefined } | BufferEncoding | undefined | null,
|
|
1161
1153
|
callback: (err: NodeJS.ErrnoException | null, files: string[] | Buffer[]) => void,
|
|
1162
1154
|
): void;
|
|
1163
1155
|
|
|
@@ -1181,21 +1173,21 @@ declare module 'fs' {
|
|
|
1181
1173
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1182
1174
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1183
1175
|
*/
|
|
1184
|
-
function __promisify__(path: PathLike, options?: { encoding: BufferEncoding | null; withFileTypes?: false } | BufferEncoding | null): Promise<string[]>;
|
|
1176
|
+
function __promisify__(path: PathLike, options?: { encoding: BufferEncoding | null; withFileTypes?: false | undefined } | BufferEncoding | null): Promise<string[]>;
|
|
1185
1177
|
|
|
1186
1178
|
/**
|
|
1187
1179
|
* Asynchronous readdir(3) - read a directory.
|
|
1188
1180
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1189
1181
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1190
1182
|
*/
|
|
1191
|
-
function __promisify__(path: PathLike, options: "buffer" | { encoding: "buffer"; withFileTypes?: false }): Promise<Buffer[]>;
|
|
1183
|
+
function __promisify__(path: PathLike, options: "buffer" | { encoding: "buffer"; withFileTypes?: false | undefined }): Promise<Buffer[]>;
|
|
1192
1184
|
|
|
1193
1185
|
/**
|
|
1194
1186
|
* Asynchronous readdir(3) - read a directory.
|
|
1195
1187
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1196
1188
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1197
1189
|
*/
|
|
1198
|
-
function __promisify__(path: PathLike, options?: BaseEncodingOptions & { withFileTypes?: false } | BufferEncoding | null): Promise<string[] | Buffer[]>;
|
|
1190
|
+
function __promisify__(path: PathLike, options?: BaseEncodingOptions & { withFileTypes?: false | undefined } | BufferEncoding | null): Promise<string[] | Buffer[]>;
|
|
1199
1191
|
|
|
1200
1192
|
/**
|
|
1201
1193
|
* Asynchronous readdir(3) - read a directory.
|
|
@@ -1210,21 +1202,21 @@ declare module 'fs' {
|
|
|
1210
1202
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1211
1203
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1212
1204
|
*/
|
|
1213
|
-
export function readdirSync(path: PathLike, options?: { encoding: BufferEncoding | null; withFileTypes?: false } | BufferEncoding | null): string[];
|
|
1205
|
+
export function readdirSync(path: PathLike, options?: { encoding: BufferEncoding | null; withFileTypes?: false | undefined } | BufferEncoding | null): string[];
|
|
1214
1206
|
|
|
1215
1207
|
/**
|
|
1216
1208
|
* Synchronous readdir(3) - read a directory.
|
|
1217
1209
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1218
1210
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1219
1211
|
*/
|
|
1220
|
-
export function readdirSync(path: PathLike, options: { encoding: "buffer"; withFileTypes?: false } | "buffer"): Buffer[];
|
|
1212
|
+
export function readdirSync(path: PathLike, options: { encoding: "buffer"; withFileTypes?: false | undefined } | "buffer"): Buffer[];
|
|
1221
1213
|
|
|
1222
1214
|
/**
|
|
1223
1215
|
* Synchronous readdir(3) - read a directory.
|
|
1224
1216
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1225
1217
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1226
1218
|
*/
|
|
1227
|
-
export function readdirSync(path: PathLike, options?: BaseEncodingOptions & { withFileTypes?: false } | BufferEncoding | null): string[] | Buffer[];
|
|
1219
|
+
export function readdirSync(path: PathLike, options?: BaseEncodingOptions & { withFileTypes?: false | undefined } | BufferEncoding | null): string[] | Buffer[];
|
|
1228
1220
|
|
|
1229
1221
|
/**
|
|
1230
1222
|
* Synchronous readdir(3) - read a directory.
|
|
@@ -1523,15 +1515,15 @@ declare module 'fs' {
|
|
|
1523
1515
|
/**
|
|
1524
1516
|
* @default 0
|
|
1525
1517
|
*/
|
|
1526
|
-
offset?: number;
|
|
1518
|
+
offset?: number | undefined;
|
|
1527
1519
|
/**
|
|
1528
1520
|
* @default `length of buffer`
|
|
1529
1521
|
*/
|
|
1530
|
-
length?: number;
|
|
1522
|
+
length?: number | undefined;
|
|
1531
1523
|
/**
|
|
1532
1524
|
* @default null
|
|
1533
1525
|
*/
|
|
1534
|
-
position?: ReadPosition | null;
|
|
1526
|
+
position?: ReadPosition | null | undefined;
|
|
1535
1527
|
}
|
|
1536
1528
|
|
|
1537
1529
|
/**
|
|
@@ -1559,7 +1551,7 @@ declare module 'fs' {
|
|
|
1559
1551
|
*/
|
|
1560
1552
|
export function readFile(
|
|
1561
1553
|
path: PathLike | number,
|
|
1562
|
-
options: { encoding?: null; flag?: string; } & Abortable | undefined | null,
|
|
1554
|
+
options: { encoding?: null | undefined; flag?: string | undefined; } & Abortable | undefined | null,
|
|
1563
1555
|
callback: (err: NodeJS.ErrnoException | null, data: Buffer) => void,
|
|
1564
1556
|
): void;
|
|
1565
1557
|
|
|
@@ -1572,7 +1564,7 @@ declare module 'fs' {
|
|
|
1572
1564
|
*/
|
|
1573
1565
|
export function readFile(
|
|
1574
1566
|
path: PathLike | number,
|
|
1575
|
-
options: { encoding: BufferEncoding; flag?: string; } & Abortable |
|
|
1567
|
+
options: { encoding: BufferEncoding; flag?: string | undefined; } & Abortable | string,
|
|
1576
1568
|
callback: (err: NodeJS.ErrnoException | null, data: string) => void,
|
|
1577
1569
|
): void;
|
|
1578
1570
|
|
|
@@ -1586,7 +1578,7 @@ declare module 'fs' {
|
|
|
1586
1578
|
export function readFile(
|
|
1587
1579
|
path: PathLike | number,
|
|
1588
1580
|
// TODO: unify the options across all readfile functions
|
|
1589
|
-
options: BaseEncodingOptions & { flag?: string; } & Abortable |
|
|
1581
|
+
options: BaseEncodingOptions & { flag?: string | undefined; } & Abortable | string | undefined | null,
|
|
1590
1582
|
callback: (err: NodeJS.ErrnoException | null, data: string | Buffer) => void,
|
|
1591
1583
|
): void;
|
|
1592
1584
|
|
|
@@ -1606,7 +1598,7 @@ declare module 'fs' {
|
|
|
1606
1598
|
* @param options An object that may contain an optional flag.
|
|
1607
1599
|
* If a flag is not provided, it defaults to `'r'`.
|
|
1608
1600
|
*/
|
|
1609
|
-
function __promisify__(path: PathLike | number, options?: { encoding?: null; flag?: string; } | null): Promise<Buffer>;
|
|
1601
|
+
function __promisify__(path: PathLike | number, options?: { encoding?: null | undefined; flag?: string | undefined; } | null): Promise<Buffer>;
|
|
1610
1602
|
|
|
1611
1603
|
/**
|
|
1612
1604
|
* Asynchronously reads the entire contents of a file.
|
|
@@ -1616,7 +1608,7 @@ declare module 'fs' {
|
|
|
1616
1608
|
* @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
|
|
1617
1609
|
* If a flag is not provided, it defaults to `'r'`.
|
|
1618
1610
|
*/
|
|
1619
|
-
function __promisify__(path: PathLike | number, options: { encoding: BufferEncoding; flag?: string; } |
|
|
1611
|
+
function __promisify__(path: PathLike | number, options: { encoding: BufferEncoding; flag?: string | undefined; } | string): Promise<string>;
|
|
1620
1612
|
|
|
1621
1613
|
/**
|
|
1622
1614
|
* Asynchronously reads the entire contents of a file.
|
|
@@ -1626,7 +1618,7 @@ declare module 'fs' {
|
|
|
1626
1618
|
* @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
|
|
1627
1619
|
* If a flag is not provided, it defaults to `'r'`.
|
|
1628
1620
|
*/
|
|
1629
|
-
function __promisify__(path: PathLike | number, options?: BaseEncodingOptions & { flag?: string; } |
|
|
1621
|
+
function __promisify__(path: PathLike | number, options?: BaseEncodingOptions & { flag?: string | undefined; } | string | null): Promise<string | Buffer>;
|
|
1630
1622
|
}
|
|
1631
1623
|
|
|
1632
1624
|
/**
|
|
@@ -1635,7 +1627,7 @@ declare module 'fs' {
|
|
|
1635
1627
|
* If a file descriptor is provided, the underlying file will _not_ be closed automatically.
|
|
1636
1628
|
* @param options An object that may contain an optional flag. If a flag is not provided, it defaults to `'r'`.
|
|
1637
1629
|
*/
|
|
1638
|
-
export function readFileSync(path: PathLike | number, options?: { encoding?: null; flag?: string; } | null): Buffer;
|
|
1630
|
+
export function readFileSync(path: PathLike | number, options?: { encoding?: null | undefined; flag?: string | undefined; } | null): Buffer;
|
|
1639
1631
|
|
|
1640
1632
|
/**
|
|
1641
1633
|
* Synchronously reads the entire contents of a file.
|
|
@@ -1644,7 +1636,7 @@ declare module 'fs' {
|
|
|
1644
1636
|
* @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
|
|
1645
1637
|
* If a flag is not provided, it defaults to `'r'`.
|
|
1646
1638
|
*/
|
|
1647
|
-
export function readFileSync(path: PathLike | number, options: { encoding: BufferEncoding; flag?: string; } | BufferEncoding): string;
|
|
1639
|
+
export function readFileSync(path: PathLike | number, options: { encoding: BufferEncoding; flag?: string | undefined; } | BufferEncoding): string;
|
|
1648
1640
|
|
|
1649
1641
|
/**
|
|
1650
1642
|
* Synchronously reads the entire contents of a file.
|
|
@@ -1653,9 +1645,9 @@ declare module 'fs' {
|
|
|
1653
1645
|
* @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
|
|
1654
1646
|
* If a flag is not provided, it defaults to `'r'`.
|
|
1655
1647
|
*/
|
|
1656
|
-
export function readFileSync(path: PathLike | number, options?: BaseEncodingOptions & { flag?: string; } | BufferEncoding | null): string | Buffer;
|
|
1648
|
+
export function readFileSync(path: PathLike | number, options?: BaseEncodingOptions & { flag?: string | undefined; } | BufferEncoding | null): string | Buffer;
|
|
1657
1649
|
|
|
1658
|
-
export type WriteFileOptions = (BaseEncodingOptions & Abortable & { mode?: Mode; flag?: string; }) |
|
|
1650
|
+
export type WriteFileOptions = (BaseEncodingOptions & Abortable & { mode?: Mode | undefined; flag?: string | undefined; }) | string | null;
|
|
1659
1651
|
|
|
1660
1652
|
/**
|
|
1661
1653
|
* Asynchronously writes data to a file, replacing the file if it already exists.
|
|
@@ -1762,7 +1754,7 @@ declare module 'fs' {
|
|
|
1762
1754
|
/**
|
|
1763
1755
|
* Watch for changes on `filename`. The callback `listener` will be called each time the file is accessed.
|
|
1764
1756
|
*/
|
|
1765
|
-
export function watchFile(filename: PathLike, options: { persistent?: boolean; interval?: number; } | undefined, listener: (curr: Stats, prev: Stats) => void): void;
|
|
1757
|
+
export function watchFile(filename: PathLike, options: { persistent?: boolean | undefined; interval?: number | undefined; } | undefined, listener: (curr: Stats, prev: Stats) => void): void;
|
|
1766
1758
|
|
|
1767
1759
|
/**
|
|
1768
1760
|
* Watch for changes on `filename`. The callback `listener` will be called each time the file is accessed.
|
|
@@ -1777,9 +1769,9 @@ declare module 'fs' {
|
|
|
1777
1769
|
export function unwatchFile(filename: PathLike, listener?: (curr: Stats, prev: Stats) => void): void;
|
|
1778
1770
|
|
|
1779
1771
|
export interface WatchOptions extends Abortable {
|
|
1780
|
-
encoding?: BufferEncoding | "buffer";
|
|
1781
|
-
persistent?: boolean;
|
|
1782
|
-
recursive?: boolean;
|
|
1772
|
+
encoding?: BufferEncoding | "buffer" | undefined;
|
|
1773
|
+
persistent?: boolean | undefined;
|
|
1774
|
+
recursive?: boolean | undefined;
|
|
1783
1775
|
}
|
|
1784
1776
|
|
|
1785
1777
|
export type WatchListener<T> = (event: "rename" | "change", filename: T) => void;
|
|
@@ -2038,34 +2030,34 @@ declare module 'fs' {
|
|
|
2038
2030
|
export function accessSync(path: PathLike, mode?: number): void;
|
|
2039
2031
|
|
|
2040
2032
|
interface StreamOptions {
|
|
2041
|
-
flags?: string;
|
|
2042
|
-
encoding?: BufferEncoding;
|
|
2043
|
-
fd?: number | promises.FileHandle;
|
|
2044
|
-
mode?: number;
|
|
2045
|
-
autoClose?: boolean;
|
|
2033
|
+
flags?: string | undefined;
|
|
2034
|
+
encoding?: BufferEncoding | undefined;
|
|
2035
|
+
fd?: number | promises.FileHandle | undefined;
|
|
2036
|
+
mode?: number | undefined;
|
|
2037
|
+
autoClose?: boolean | undefined;
|
|
2046
2038
|
/**
|
|
2047
2039
|
* @default false
|
|
2048
2040
|
*/
|
|
2049
|
-
emitClose?: boolean;
|
|
2050
|
-
start?: number;
|
|
2051
|
-
highWaterMark?: number;
|
|
2041
|
+
emitClose?: boolean | undefined;
|
|
2042
|
+
start?: number | undefined;
|
|
2043
|
+
highWaterMark?: number | undefined;
|
|
2052
2044
|
}
|
|
2053
2045
|
|
|
2054
2046
|
interface ReadStreamOptions extends StreamOptions {
|
|
2055
|
-
end?: number;
|
|
2047
|
+
end?: number | undefined;
|
|
2056
2048
|
}
|
|
2057
2049
|
|
|
2058
2050
|
/**
|
|
2059
2051
|
* Returns a new `ReadStream` object.
|
|
2060
2052
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
2061
2053
|
*/
|
|
2062
|
-
export function createReadStream(path: PathLike, options?:
|
|
2054
|
+
export function createReadStream(path: PathLike, options?: string | ReadStreamOptions): ReadStream;
|
|
2063
2055
|
|
|
2064
2056
|
/**
|
|
2065
2057
|
* Returns a new `WriteStream` object.
|
|
2066
2058
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
2067
2059
|
*/
|
|
2068
|
-
export function createWriteStream(path: PathLike, options?:
|
|
2060
|
+
export function createWriteStream(path: PathLike, options?: string | StreamOptions): WriteStream;
|
|
2069
2061
|
|
|
2070
2062
|
/**
|
|
2071
2063
|
* Asynchronous fdatasync(2) - synchronize a file's in-core state with storage device.
|
|
@@ -2199,14 +2191,14 @@ declare module 'fs' {
|
|
|
2199
2191
|
export function readvSync(fd: number, buffers: ReadonlyArray<NodeJS.ArrayBufferView>, position?: number): number;
|
|
2200
2192
|
|
|
2201
2193
|
export interface OpenDirOptions {
|
|
2202
|
-
encoding?: BufferEncoding;
|
|
2194
|
+
encoding?: BufferEncoding | undefined;
|
|
2203
2195
|
/**
|
|
2204
2196
|
* Number of directory entries that are buffered
|
|
2205
2197
|
* internally when reading from the directory. Higher values lead to better
|
|
2206
2198
|
* performance but higher memory usage.
|
|
2207
2199
|
* @default 32
|
|
2208
2200
|
*/
|
|
2209
|
-
bufferSize?: number;
|
|
2201
|
+
bufferSize?: number | undefined;
|
|
2210
2202
|
}
|
|
2211
2203
|
|
|
2212
2204
|
export function opendirSync(path: string, options?: OpenDirOptions): Dir;
|
|
@@ -2233,7 +2225,11 @@ declare module 'fs' {
|
|
|
2233
2225
|
}
|
|
2234
2226
|
|
|
2235
2227
|
export interface StatOptions {
|
|
2236
|
-
bigint?: boolean;
|
|
2237
|
-
throwIfNoEntry?: boolean;
|
|
2228
|
+
bigint?: boolean | undefined;
|
|
2229
|
+
throwIfNoEntry?: boolean | undefined;
|
|
2238
2230
|
}
|
|
2239
2231
|
}
|
|
2232
|
+
|
|
2233
|
+
declare module 'node:fs' {
|
|
2234
|
+
export * from 'fs';
|
|
2235
|
+
}
|