@types/node 14.18.9 → 15.0.3
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 → node}/LICENSE +0 -0
- node v14.18/README.md → node/README.md +4 -4
- node/assert/strict.d.ts +4 -0
- node v14.18/assert.d.ts → node/assert.d.ts +3 -7
- node v14.18/async_hooks.d.ts → node/async_hooks.d.ts +2 -5
- node/base.d.ts +19 -0
- node/buffer.d.ts +22 -0
- node v14.18/child_process.d.ts → node/child_process.d.ts +63 -67
- node v14.18/cluster.d.ts → node/cluster.d.ts +10 -13
- node v14.18/console.d.ts → node/console.d.ts +13 -22
- node v14.18/constants.d.ts → node/constants.d.ts +0 -5
- node v14.18/crypto.d.ts → node/crypto.d.ts +134 -53
- node v14.18/dgram.d.ts → node/dgram.d.ts +17 -20
- node/dns/promises.d.ts +97 -0
- node/dns.d.ts +322 -0
- node v14.18/domain.d.ts → node/domain.d.ts +0 -3
- node v14.18/events.d.ts → node/events.d.ts +8 -8
- node v14.18/fs/promises.d.ts → node/fs/promises.d.ts +18 -29
- node v14.18/fs.d.ts → node/fs.d.ts +77 -93
- node v14.18/globals.d.ts → node/globals.d.ts +60 -67
- {node v14.18 → node}/globals.global.d.ts +0 -0
- node v14.18/http.d.ts → node/http.d.ts +108 -176
- node v14.18/http2.d.ts → node/http2.d.ts +74 -71
- node/https.d.ts +36 -0
- node v14.18/index.d.ts → node/index.d.ts +15 -55
- node v14.18/inspector.d.ts → node/inspector.d.ts +151 -161
- node v14.18/module.d.ts → node/module.d.ts +0 -4
- node v14.18/net.d.ts → node/net.d.ts +68 -38
- node v14.18/os.d.ts → node/os.d.ts +0 -3
- node v14.18/package.json → node/package.json +25 -19
- node v14.18/path.d.ts → node/path.d.ts +5 -9
- node v14.18/perf_hooks.d.ts → node/perf_hooks.d.ts +5 -8
- node v14.18/process.d.ts → node/process.d.ts +53 -17
- node v14.18/punycode.d.ts → node/punycode.d.ts +0 -3
- node v14.18/querystring.d.ts → node/querystring.d.ts +3 -6
- node v14.18/readline.d.ts → node/readline.d.ts +14 -18
- node v14.18/repl.d.ts → node/repl.d.ts +14 -17
- node/stream/promises.d.ts +67 -0
- node v14.18/stream.d.ts → node/stream.d.ts +164 -60
- node v14.18/string_decoder.d.ts → node/string_decoder.d.ts +0 -3
- node/timers/promises.d.ts +13 -0
- node v14.18/timers.d.ts → node/timers.d.ts +16 -5
- node v14.18/tls.d.ts → node/tls.d.ts +51 -56
- node v14.18/trace_events.d.ts → node/trace_events.d.ts +0 -3
- node/ts3.6/assert.d.ts +98 -0
- node/ts3.6/base.d.ts +66 -0
- node/ts3.6/index.d.ts +7 -0
- node v14.18/tty.d.ts → node/tty.d.ts +0 -3
- node v14.18/url.d.ts → node/url.d.ts +16 -19
- node v14.18/util.d.ts → node/util.d.ts +3 -12
- node v14.18/v8.d.ts → node/v8.d.ts +0 -3
- node v14.18/vm.d.ts → node/vm.d.ts +24 -27
- node v14.18/wasi.d.ts → node/wasi.d.ts +7 -10
- node v14.18/worker_threads.d.ts → node/worker_threads.d.ts +18 -18
- node v14.18/zlib.d.ts → node/zlib.d.ts +16 -19
- node v14.18/buffer.d.ts +0 -89
- node v14.18/dns.d.ts +0 -387
- node v14.18/https.d.ts +0 -142
|
@@ -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;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
export type OpenMode = number | string;
|
|
@@ -143,7 +143,7 @@ declare module 'fs' {
|
|
|
143
143
|
}
|
|
144
144
|
|
|
145
145
|
export class ReadStream extends stream.Readable {
|
|
146
|
-
close(
|
|
146
|
+
close(): void;
|
|
147
147
|
bytesRead: number;
|
|
148
148
|
path: string | Buffer;
|
|
149
149
|
pending: boolean;
|
|
@@ -211,7 +211,7 @@ declare module 'fs' {
|
|
|
211
211
|
}
|
|
212
212
|
|
|
213
213
|
export class WriteStream extends stream.Writable {
|
|
214
|
-
close(
|
|
214
|
+
close(): void;
|
|
215
215
|
bytesWritten: number;
|
|
216
216
|
path: string | Buffer;
|
|
217
217
|
pending: boolean;
|
|
@@ -537,7 +537,7 @@ declare module 'fs' {
|
|
|
537
537
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
538
538
|
*/
|
|
539
539
|
export function stat(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
|
|
540
|
-
export function stat(path: PathLike, options: StatOptions & { bigint?: false
|
|
540
|
+
export function stat(path: PathLike, options: StatOptions & { bigint?: false } | undefined, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
|
|
541
541
|
export function stat(path: PathLike, options: StatOptions & { bigint: true }, callback: (err: NodeJS.ErrnoException | null, stats: BigIntStats) => void): void;
|
|
542
542
|
export function stat(path: PathLike, options: StatOptions | undefined, callback: (err: NodeJS.ErrnoException | null, stats: Stats | BigIntStats) => void): void;
|
|
543
543
|
|
|
@@ -547,7 +547,7 @@ declare module 'fs' {
|
|
|
547
547
|
* Asynchronous stat(2) - Get file status.
|
|
548
548
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
549
549
|
*/
|
|
550
|
-
function __promisify__(path: PathLike, options?: StatOptions & { bigint?: false
|
|
550
|
+
function __promisify__(path: PathLike, options?: StatOptions & { bigint?: false }): Promise<Stats>;
|
|
551
551
|
function __promisify__(path: PathLike, options: StatOptions & { bigint: true }): Promise<BigIntStats>;
|
|
552
552
|
function __promisify__(path: PathLike, options?: StatOptions): Promise<Stats | BigIntStats>;
|
|
553
553
|
}
|
|
@@ -556,7 +556,7 @@ declare module 'fs' {
|
|
|
556
556
|
* Synchronous stat(2) - Get file status.
|
|
557
557
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
558
558
|
*/
|
|
559
|
-
export function statSync(path: PathLike, options?: StatOptions & { bigint?: false
|
|
559
|
+
export function statSync(path: PathLike, options?: StatOptions & { bigint?: false }): Stats;
|
|
560
560
|
export function statSync(path: PathLike, options: StatOptions & { bigint: true }): BigIntStats;
|
|
561
561
|
export function statSync(path: PathLike, options?: StatOptions): Stats | BigIntStats;
|
|
562
562
|
|
|
@@ -565,7 +565,7 @@ declare module 'fs' {
|
|
|
565
565
|
* @param fd A file descriptor.
|
|
566
566
|
*/
|
|
567
567
|
export function fstat(fd: number, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
|
|
568
|
-
export function fstat(fd: number, options: StatOptions & { bigint?: false
|
|
568
|
+
export function fstat(fd: number, options: StatOptions & { bigint?: false } | undefined, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
|
|
569
569
|
export function fstat(fd: number, options: StatOptions & { bigint: true }, callback: (err: NodeJS.ErrnoException | null, stats: BigIntStats) => void): void;
|
|
570
570
|
export function fstat(fd: number, options: StatOptions | undefined, callback: (err: NodeJS.ErrnoException | null, stats: Stats | BigIntStats) => void): void;
|
|
571
571
|
|
|
@@ -575,7 +575,7 @@ declare module 'fs' {
|
|
|
575
575
|
* Asynchronous fstat(2) - Get file status.
|
|
576
576
|
* @param fd A file descriptor.
|
|
577
577
|
*/
|
|
578
|
-
function __promisify__(fd: number, options?: StatOptions & { bigint?: false
|
|
578
|
+
function __promisify__(fd: number, options?: StatOptions & { bigint?: false }): Promise<Stats>;
|
|
579
579
|
function __promisify__(fd: number, options: StatOptions & { bigint: true }): Promise<BigIntStats>;
|
|
580
580
|
function __promisify__(fd: number, options?: StatOptions): Promise<Stats | BigIntStats>;
|
|
581
581
|
}
|
|
@@ -584,7 +584,7 @@ declare module 'fs' {
|
|
|
584
584
|
* Synchronous fstat(2) - Get file status.
|
|
585
585
|
* @param fd A file descriptor.
|
|
586
586
|
*/
|
|
587
|
-
export function fstatSync(fd: number, options?: StatOptions & { bigint?: false
|
|
587
|
+
export function fstatSync(fd: number, options?: StatOptions & { bigint?: false }): Stats;
|
|
588
588
|
export function fstatSync(fd: number, options: StatOptions & { bigint: true }): BigIntStats;
|
|
589
589
|
export function fstatSync(fd: number, options?: StatOptions): Stats | BigIntStats;
|
|
590
590
|
|
|
@@ -593,7 +593,7 @@ declare module 'fs' {
|
|
|
593
593
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
594
594
|
*/
|
|
595
595
|
export function lstat(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
|
|
596
|
-
export function lstat(path: PathLike, options: StatOptions & { bigint?: false
|
|
596
|
+
export function lstat(path: PathLike, options: StatOptions & { bigint?: false } | undefined, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
|
|
597
597
|
export function lstat(path: PathLike, options: StatOptions & { bigint: true }, callback: (err: NodeJS.ErrnoException | null, stats: BigIntStats) => void): void;
|
|
598
598
|
export function lstat(path: PathLike, options: StatOptions | undefined, callback: (err: NodeJS.ErrnoException | null, stats: Stats | BigIntStats) => void): void;
|
|
599
599
|
|
|
@@ -603,7 +603,7 @@ declare module 'fs' {
|
|
|
603
603
|
* Asynchronous lstat(2) - Get file status. Does not dereference symbolic links.
|
|
604
604
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
605
605
|
*/
|
|
606
|
-
function __promisify__(path: PathLike, options?: StatOptions & { bigint?: false
|
|
606
|
+
function __promisify__(path: PathLike, options?: StatOptions & { bigint?: false }): Promise<Stats>;
|
|
607
607
|
function __promisify__(path: PathLike, options: StatOptions & { bigint: true }): Promise<BigIntStats>;
|
|
608
608
|
function __promisify__(path: PathLike, options?: StatOptions): Promise<Stats | BigIntStats>;
|
|
609
609
|
}
|
|
@@ -612,7 +612,7 @@ declare module 'fs' {
|
|
|
612
612
|
* Synchronous lstat(2) - Get file status. Does not dereference symbolic links.
|
|
613
613
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
614
614
|
*/
|
|
615
|
-
export function lstatSync(path: PathLike, options?: StatOptions & { bigint?: false
|
|
615
|
+
export function lstatSync(path: PathLike, options?: StatOptions & { bigint?: false }): Stats;
|
|
616
616
|
export function lstatSync(path: PathLike, options: StatOptions & { bigint: true }): BigIntStats;
|
|
617
617
|
export function lstatSync(path: PathLike, options?: StatOptions): Stats | BigIntStats;
|
|
618
618
|
|
|
@@ -876,11 +876,10 @@ declare module 'fs' {
|
|
|
876
876
|
* `true`.
|
|
877
877
|
* @default 0
|
|
878
878
|
*/
|
|
879
|
-
maxRetries?: number
|
|
879
|
+
maxRetries?: number;
|
|
880
880
|
/**
|
|
881
881
|
* @deprecated since v14.14.0 In future versions of Node.js,
|
|
882
|
-
* `fs.rmdir(path, { recursive: true })` will throw
|
|
883
|
-
* paths, or when given a file as a target.
|
|
882
|
+
* `fs.rmdir(path, { recursive: true })` will throw if `path` does not exist or is a file.
|
|
884
883
|
* Use `fs.rm(path, { recursive: true, force: true })` instead.
|
|
885
884
|
*
|
|
886
885
|
* If `true`, perform a recursive directory removal. In
|
|
@@ -888,13 +887,13 @@ declare module 'fs' {
|
|
|
888
887
|
* operations are retried on failure.
|
|
889
888
|
* @default false
|
|
890
889
|
*/
|
|
891
|
-
recursive?: boolean
|
|
890
|
+
recursive?: boolean;
|
|
892
891
|
/**
|
|
893
892
|
* The amount of time in milliseconds to wait between retries.
|
|
894
893
|
* This option is ignored if the `recursive` option is not `true`.
|
|
895
894
|
* @default 100
|
|
896
895
|
*/
|
|
897
|
-
retryDelay?: number
|
|
896
|
+
retryDelay?: number;
|
|
898
897
|
}
|
|
899
898
|
|
|
900
899
|
/**
|
|
@@ -924,7 +923,7 @@ declare module 'fs' {
|
|
|
924
923
|
* When `true`, exceptions will be ignored if `path` does not exist.
|
|
925
924
|
* @default false
|
|
926
925
|
*/
|
|
927
|
-
force?: boolean
|
|
926
|
+
force?: boolean;
|
|
928
927
|
/**
|
|
929
928
|
* If an `EBUSY`, `EMFILE`, `ENFILE`, `ENOTEMPTY`, or
|
|
930
929
|
* `EPERM` error is encountered, Node.js will retry the operation with a linear
|
|
@@ -933,20 +932,20 @@ declare module 'fs' {
|
|
|
933
932
|
* `true`.
|
|
934
933
|
* @default 0
|
|
935
934
|
*/
|
|
936
|
-
maxRetries?: number
|
|
935
|
+
maxRetries?: number;
|
|
937
936
|
/**
|
|
938
937
|
* If `true`, perform a recursive directory removal. In
|
|
939
938
|
* recursive mode, errors are not reported if `path` does not exist, and
|
|
940
939
|
* operations are retried on failure.
|
|
941
940
|
* @default false
|
|
942
941
|
*/
|
|
943
|
-
recursive?: boolean
|
|
942
|
+
recursive?: boolean;
|
|
944
943
|
/**
|
|
945
944
|
* The amount of time in milliseconds to wait between retries.
|
|
946
945
|
* This option is ignored if the `recursive` option is not `true`.
|
|
947
946
|
* @default 100
|
|
948
947
|
*/
|
|
949
|
-
retryDelay?: number
|
|
948
|
+
retryDelay?: number;
|
|
950
949
|
}
|
|
951
950
|
|
|
952
951
|
/**
|
|
@@ -974,12 +973,12 @@ declare module 'fs' {
|
|
|
974
973
|
* If a folder was created, the path to the first created folder will be returned.
|
|
975
974
|
* @default false
|
|
976
975
|
*/
|
|
977
|
-
recursive?: boolean
|
|
976
|
+
recursive?: boolean;
|
|
978
977
|
/**
|
|
979
978
|
* A file mode. If a string is passed, it is parsed as an octal integer. If not specified
|
|
980
979
|
* @default 0o777
|
|
981
980
|
*/
|
|
982
|
-
mode?: Mode
|
|
981
|
+
mode?: Mode;
|
|
983
982
|
}
|
|
984
983
|
|
|
985
984
|
/**
|
|
@@ -996,7 +995,7 @@ declare module 'fs' {
|
|
|
996
995
|
* @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
|
|
997
996
|
* should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
|
|
998
997
|
*/
|
|
999
|
-
export function mkdir(path: PathLike, options: Mode | (MakeDirectoryOptions & { recursive?: false
|
|
998
|
+
export function mkdir(path: PathLike, options: Mode | (MakeDirectoryOptions & { recursive?: false; }) | null | undefined, callback: NoParamCallback): void;
|
|
1000
999
|
|
|
1001
1000
|
/**
|
|
1002
1001
|
* Asynchronous mkdir(2) - create a directory.
|
|
@@ -1028,7 +1027,7 @@ declare module 'fs' {
|
|
|
1028
1027
|
* @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
|
|
1029
1028
|
* should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
|
|
1030
1029
|
*/
|
|
1031
|
-
function __promisify__(path: PathLike, options?: Mode | (MakeDirectoryOptions & { recursive?: false
|
|
1030
|
+
function __promisify__(path: PathLike, options?: Mode | (MakeDirectoryOptions & { recursive?: false; }) | null): Promise<void>;
|
|
1032
1031
|
|
|
1033
1032
|
/**
|
|
1034
1033
|
* Asynchronous mkdir(2) - create a directory.
|
|
@@ -1053,7 +1052,7 @@ declare module 'fs' {
|
|
|
1053
1052
|
* @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
|
|
1054
1053
|
* should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
|
|
1055
1054
|
*/
|
|
1056
|
-
export function mkdirSync(path: PathLike, options?: Mode | (MakeDirectoryOptions & { recursive?: false
|
|
1055
|
+
export function mkdirSync(path: PathLike, options?: Mode | (MakeDirectoryOptions & { recursive?: false; }) | null): void;
|
|
1057
1056
|
|
|
1058
1057
|
/**
|
|
1059
1058
|
* Synchronous mkdir(2) - create a directory.
|
|
@@ -1142,7 +1141,7 @@ declare module 'fs' {
|
|
|
1142
1141
|
*/
|
|
1143
1142
|
export function readdir(
|
|
1144
1143
|
path: PathLike,
|
|
1145
|
-
options: { encoding: BufferEncoding | null; withFileTypes?: false
|
|
1144
|
+
options: { encoding: BufferEncoding | null; withFileTypes?: false } | BufferEncoding | undefined | null,
|
|
1146
1145
|
callback: (err: NodeJS.ErrnoException | null, files: string[]) => void,
|
|
1147
1146
|
): void;
|
|
1148
1147
|
|
|
@@ -1151,11 +1150,7 @@ declare module 'fs' {
|
|
|
1151
1150
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1152
1151
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1153
1152
|
*/
|
|
1154
|
-
export function readdir(
|
|
1155
|
-
path: PathLike,
|
|
1156
|
-
options: { encoding: "buffer"; withFileTypes?: false | undefined } | "buffer",
|
|
1157
|
-
callback: (err: NodeJS.ErrnoException | null, files: Buffer[]) => void
|
|
1158
|
-
): void;
|
|
1153
|
+
export function readdir(path: PathLike, options: { encoding: "buffer"; withFileTypes?: false } | "buffer", callback: (err: NodeJS.ErrnoException | null, files: Buffer[]) => void): void;
|
|
1159
1154
|
|
|
1160
1155
|
/**
|
|
1161
1156
|
* Asynchronous readdir(3) - read a directory.
|
|
@@ -1164,7 +1159,7 @@ declare module 'fs' {
|
|
|
1164
1159
|
*/
|
|
1165
1160
|
export function readdir(
|
|
1166
1161
|
path: PathLike,
|
|
1167
|
-
options: BaseEncodingOptions & { withFileTypes?: false
|
|
1162
|
+
options: BaseEncodingOptions & { withFileTypes?: false } | BufferEncoding | undefined | null,
|
|
1168
1163
|
callback: (err: NodeJS.ErrnoException | null, files: string[] | Buffer[]) => void,
|
|
1169
1164
|
): void;
|
|
1170
1165
|
|
|
@@ -1188,21 +1183,21 @@ declare module 'fs' {
|
|
|
1188
1183
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1189
1184
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1190
1185
|
*/
|
|
1191
|
-
function __promisify__(path: PathLike, options?: { encoding: BufferEncoding | null; withFileTypes?: false
|
|
1186
|
+
function __promisify__(path: PathLike, options?: { encoding: BufferEncoding | null; withFileTypes?: false } | BufferEncoding | null): Promise<string[]>;
|
|
1192
1187
|
|
|
1193
1188
|
/**
|
|
1194
1189
|
* Asynchronous readdir(3) - read a directory.
|
|
1195
1190
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1196
1191
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1197
1192
|
*/
|
|
1198
|
-
function __promisify__(path: PathLike, options: "buffer" | { encoding: "buffer"; withFileTypes?: false
|
|
1193
|
+
function __promisify__(path: PathLike, options: "buffer" | { encoding: "buffer"; withFileTypes?: false }): Promise<Buffer[]>;
|
|
1199
1194
|
|
|
1200
1195
|
/**
|
|
1201
1196
|
* Asynchronous readdir(3) - read a directory.
|
|
1202
1197
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1203
1198
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1204
1199
|
*/
|
|
1205
|
-
function __promisify__(path: PathLike, options?: BaseEncodingOptions & { withFileTypes?: false
|
|
1200
|
+
function __promisify__(path: PathLike, options?: BaseEncodingOptions & { withFileTypes?: false } | BufferEncoding | null): Promise<string[] | Buffer[]>;
|
|
1206
1201
|
|
|
1207
1202
|
/**
|
|
1208
1203
|
* Asynchronous readdir(3) - read a directory.
|
|
@@ -1217,21 +1212,21 @@ declare module 'fs' {
|
|
|
1217
1212
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1218
1213
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1219
1214
|
*/
|
|
1220
|
-
export function readdirSync(path: PathLike, options?: { encoding: BufferEncoding | null; withFileTypes?: false
|
|
1215
|
+
export function readdirSync(path: PathLike, options?: { encoding: BufferEncoding | null; withFileTypes?: false } | BufferEncoding | null): string[];
|
|
1221
1216
|
|
|
1222
1217
|
/**
|
|
1223
1218
|
* Synchronous readdir(3) - read a directory.
|
|
1224
1219
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1225
1220
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1226
1221
|
*/
|
|
1227
|
-
export function readdirSync(path: PathLike, options: { encoding: "buffer"; withFileTypes?: false
|
|
1222
|
+
export function readdirSync(path: PathLike, options: { encoding: "buffer"; withFileTypes?: false } | "buffer"): Buffer[];
|
|
1228
1223
|
|
|
1229
1224
|
/**
|
|
1230
1225
|
* Synchronous readdir(3) - read a directory.
|
|
1231
1226
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1232
1227
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1233
1228
|
*/
|
|
1234
|
-
export function readdirSync(path: PathLike, options?: BaseEncodingOptions & { withFileTypes?: false
|
|
1229
|
+
export function readdirSync(path: PathLike, options?: BaseEncodingOptions & { withFileTypes?: false } | BufferEncoding | null): string[] | Buffer[];
|
|
1235
1230
|
|
|
1236
1231
|
/**
|
|
1237
1232
|
* Synchronous readdir(3) - read a directory.
|
|
@@ -1528,15 +1523,15 @@ declare module 'fs' {
|
|
|
1528
1523
|
/**
|
|
1529
1524
|
* @default 0
|
|
1530
1525
|
*/
|
|
1531
|
-
offset?: number
|
|
1526
|
+
offset?: number;
|
|
1532
1527
|
/**
|
|
1533
1528
|
* @default `length of buffer`
|
|
1534
1529
|
*/
|
|
1535
|
-
length?: number
|
|
1530
|
+
length?: number;
|
|
1536
1531
|
/**
|
|
1537
1532
|
* @default null
|
|
1538
1533
|
*/
|
|
1539
|
-
position?: number | null
|
|
1534
|
+
position?: number | null;
|
|
1540
1535
|
}
|
|
1541
1536
|
|
|
1542
1537
|
/**
|
|
@@ -1562,11 +1557,7 @@ declare module 'fs' {
|
|
|
1562
1557
|
* @param options An object that may contain an optional flag.
|
|
1563
1558
|
* If a flag is not provided, it defaults to `'r'`.
|
|
1564
1559
|
*/
|
|
1565
|
-
export function readFile(
|
|
1566
|
-
path: PathLike | number,
|
|
1567
|
-
options: { encoding?: null | undefined; flag?: string | undefined; } | undefined | null,
|
|
1568
|
-
callback: (err: NodeJS.ErrnoException | null, data: Buffer) => void
|
|
1569
|
-
): void;
|
|
1560
|
+
export function readFile(path: PathLike | number, options: { encoding?: null; flag?: string; } | undefined | null, callback: (err: NodeJS.ErrnoException | null, data: Buffer) => void): void;
|
|
1570
1561
|
|
|
1571
1562
|
/**
|
|
1572
1563
|
* Asynchronously reads the entire contents of a file.
|
|
@@ -1576,11 +1567,7 @@ declare module 'fs' {
|
|
|
1576
1567
|
* @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
|
|
1577
1568
|
* If a flag is not provided, it defaults to `'r'`.
|
|
1578
1569
|
*/
|
|
1579
|
-
export function readFile(
|
|
1580
|
-
path: PathLike | number,
|
|
1581
|
-
options: { encoding: BufferEncoding; flag?: string | undefined; } | BufferEncoding,
|
|
1582
|
-
callback: (err: NodeJS.ErrnoException | null, data: string) => void
|
|
1583
|
-
): void;
|
|
1570
|
+
export function readFile(path: PathLike | number, options: { encoding: BufferEncoding; flag?: string; } | string, callback: (err: NodeJS.ErrnoException | null, data: string) => void): void;
|
|
1584
1571
|
|
|
1585
1572
|
/**
|
|
1586
1573
|
* Asynchronously reads the entire contents of a file.
|
|
@@ -1592,7 +1579,7 @@ declare module 'fs' {
|
|
|
1592
1579
|
*/
|
|
1593
1580
|
export function readFile(
|
|
1594
1581
|
path: PathLike | number,
|
|
1595
|
-
options: BaseEncodingOptions & { flag?: string
|
|
1582
|
+
options: BaseEncodingOptions & { flag?: string; } | string | undefined | null,
|
|
1596
1583
|
callback: (err: NodeJS.ErrnoException | null, data: string | Buffer) => void,
|
|
1597
1584
|
): void;
|
|
1598
1585
|
|
|
@@ -1612,7 +1599,7 @@ declare module 'fs' {
|
|
|
1612
1599
|
* @param options An object that may contain an optional flag.
|
|
1613
1600
|
* If a flag is not provided, it defaults to `'r'`.
|
|
1614
1601
|
*/
|
|
1615
|
-
function __promisify__(path: PathLike | number, options?: { encoding?: null
|
|
1602
|
+
function __promisify__(path: PathLike | number, options?: { encoding?: null; flag?: string; } | null): Promise<Buffer>;
|
|
1616
1603
|
|
|
1617
1604
|
/**
|
|
1618
1605
|
* Asynchronously reads the entire contents of a file.
|
|
@@ -1622,7 +1609,7 @@ declare module 'fs' {
|
|
|
1622
1609
|
* @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
|
|
1623
1610
|
* If a flag is not provided, it defaults to `'r'`.
|
|
1624
1611
|
*/
|
|
1625
|
-
function __promisify__(path: PathLike | number, options: { encoding: BufferEncoding; flag?: string
|
|
1612
|
+
function __promisify__(path: PathLike | number, options: { encoding: BufferEncoding; flag?: string; } | string): Promise<string>;
|
|
1626
1613
|
|
|
1627
1614
|
/**
|
|
1628
1615
|
* Asynchronously reads the entire contents of a file.
|
|
@@ -1632,7 +1619,7 @@ declare module 'fs' {
|
|
|
1632
1619
|
* @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
|
|
1633
1620
|
* If a flag is not provided, it defaults to `'r'`.
|
|
1634
1621
|
*/
|
|
1635
|
-
function __promisify__(path: PathLike | number, options?: BaseEncodingOptions & { flag?: string
|
|
1622
|
+
function __promisify__(path: PathLike | number, options?: BaseEncodingOptions & { flag?: string; } | string | null): Promise<string | Buffer>;
|
|
1636
1623
|
}
|
|
1637
1624
|
|
|
1638
1625
|
/**
|
|
@@ -1642,7 +1629,7 @@ declare module 'fs' {
|
|
|
1642
1629
|
* If a file descriptor is provided, the underlying file will _not_ be closed automatically.
|
|
1643
1630
|
* @param options An object that may contain an optional flag. If a flag is not provided, it defaults to `'r'`.
|
|
1644
1631
|
*/
|
|
1645
|
-
export function readFileSync(path: PathLike | number, options?: { encoding?: null
|
|
1632
|
+
export function readFileSync(path: PathLike | number, options?: { encoding?: null; flag?: string; } | null): Buffer;
|
|
1646
1633
|
|
|
1647
1634
|
/**
|
|
1648
1635
|
* Synchronously reads the entire contents of a file.
|
|
@@ -1652,7 +1639,7 @@ declare module 'fs' {
|
|
|
1652
1639
|
* @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
|
|
1653
1640
|
* If a flag is not provided, it defaults to `'r'`.
|
|
1654
1641
|
*/
|
|
1655
|
-
export function readFileSync(path: PathLike | number, options: { encoding: BufferEncoding; flag?: string
|
|
1642
|
+
export function readFileSync(path: PathLike | number, options: { encoding: BufferEncoding; flag?: string; } | BufferEncoding): string;
|
|
1656
1643
|
|
|
1657
1644
|
/**
|
|
1658
1645
|
* Synchronously reads the entire contents of a file.
|
|
@@ -1662,9 +1649,9 @@ declare module 'fs' {
|
|
|
1662
1649
|
* @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
|
|
1663
1650
|
* If a flag is not provided, it defaults to `'r'`.
|
|
1664
1651
|
*/
|
|
1665
|
-
export function readFileSync(path: PathLike | number, options?: BaseEncodingOptions & { flag?: string
|
|
1652
|
+
export function readFileSync(path: PathLike | number, options?: BaseEncodingOptions & { flag?: string; } | BufferEncoding | null): string | Buffer;
|
|
1666
1653
|
|
|
1667
|
-
export type WriteFileOptions = BaseEncodingOptions & { mode?: Mode
|
|
1654
|
+
export type WriteFileOptions = BaseEncodingOptions & { mode?: Mode; flag?: string; } | string | null;
|
|
1668
1655
|
|
|
1669
1656
|
/**
|
|
1670
1657
|
* Asynchronously writes data to a file, replacing the file if it already exists.
|
|
@@ -1777,7 +1764,7 @@ declare module 'fs' {
|
|
|
1777
1764
|
/**
|
|
1778
1765
|
* Watch for changes on `filename`. The callback `listener` will be called each time the file is accessed.
|
|
1779
1766
|
*/
|
|
1780
|
-
export function watchFile(filename: PathLike, options: { persistent?: boolean
|
|
1767
|
+
export function watchFile(filename: PathLike, options: { persistent?: boolean; interval?: number; } | undefined, listener: (curr: Stats, prev: Stats) => void): void;
|
|
1781
1768
|
|
|
1782
1769
|
/**
|
|
1783
1770
|
* Watch for changes on `filename`. The callback `listener` will be called each time the file is accessed.
|
|
@@ -1804,7 +1791,7 @@ declare module 'fs' {
|
|
|
1804
1791
|
*/
|
|
1805
1792
|
export function watch(
|
|
1806
1793
|
filename: PathLike,
|
|
1807
|
-
options: { encoding?: BufferEncoding | null
|
|
1794
|
+
options: { encoding?: BufferEncoding | null, persistent?: boolean, recursive?: boolean } | BufferEncoding | undefined | null,
|
|
1808
1795
|
listener?: (event: "rename" | "change", filename: string) => void,
|
|
1809
1796
|
): FSWatcher;
|
|
1810
1797
|
|
|
@@ -1819,7 +1806,7 @@ declare module 'fs' {
|
|
|
1819
1806
|
*/
|
|
1820
1807
|
export function watch(
|
|
1821
1808
|
filename: PathLike,
|
|
1822
|
-
options: { encoding: "buffer", persistent?: boolean
|
|
1809
|
+
options: { encoding: "buffer", persistent?: boolean, recursive?: boolean; } | "buffer",
|
|
1823
1810
|
listener?: (event: "rename" | "change", filename: Buffer) => void
|
|
1824
1811
|
): FSWatcher;
|
|
1825
1812
|
|
|
@@ -1834,7 +1821,7 @@ declare module 'fs' {
|
|
|
1834
1821
|
*/
|
|
1835
1822
|
export function watch(
|
|
1836
1823
|
filename: PathLike,
|
|
1837
|
-
options: { encoding?: BufferEncoding | null
|
|
1824
|
+
options: { encoding?: BufferEncoding | null, persistent?: boolean, recursive?: boolean } | string | null,
|
|
1838
1825
|
listener?: (event: "rename" | "change", filename: string | Buffer) => void,
|
|
1839
1826
|
): FSWatcher;
|
|
1840
1827
|
|
|
@@ -2068,19 +2055,19 @@ declare module 'fs' {
|
|
|
2068
2055
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
2069
2056
|
* URL support is _experimental_.
|
|
2070
2057
|
*/
|
|
2071
|
-
export function createReadStream(path: PathLike, options?:
|
|
2072
|
-
flags?: string
|
|
2073
|
-
encoding?: BufferEncoding
|
|
2074
|
-
fd?: number
|
|
2075
|
-
mode?: number
|
|
2076
|
-
autoClose?: boolean
|
|
2058
|
+
export function createReadStream(path: PathLike, options?: string | {
|
|
2059
|
+
flags?: string;
|
|
2060
|
+
encoding?: BufferEncoding;
|
|
2061
|
+
fd?: number;
|
|
2062
|
+
mode?: number;
|
|
2063
|
+
autoClose?: boolean;
|
|
2077
2064
|
/**
|
|
2078
2065
|
* @default false
|
|
2079
2066
|
*/
|
|
2080
|
-
emitClose?: boolean
|
|
2081
|
-
start?: number
|
|
2082
|
-
end?: number
|
|
2083
|
-
highWaterMark?: number
|
|
2067
|
+
emitClose?: boolean;
|
|
2068
|
+
start?: number;
|
|
2069
|
+
end?: number;
|
|
2070
|
+
highWaterMark?: number;
|
|
2084
2071
|
}): ReadStream;
|
|
2085
2072
|
|
|
2086
2073
|
/**
|
|
@@ -2088,15 +2075,15 @@ declare module 'fs' {
|
|
|
2088
2075
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
2089
2076
|
* URL support is _experimental_.
|
|
2090
2077
|
*/
|
|
2091
|
-
export function createWriteStream(path: PathLike, options?:
|
|
2092
|
-
flags?: string
|
|
2093
|
-
encoding?: BufferEncoding
|
|
2094
|
-
fd?: number
|
|
2095
|
-
mode?: number
|
|
2096
|
-
autoClose?: boolean
|
|
2097
|
-
emitClose?: boolean
|
|
2098
|
-
start?: number
|
|
2099
|
-
highWaterMark?: number
|
|
2078
|
+
export function createWriteStream(path: PathLike, options?: string | {
|
|
2079
|
+
flags?: string;
|
|
2080
|
+
encoding?: BufferEncoding;
|
|
2081
|
+
fd?: number;
|
|
2082
|
+
mode?: number;
|
|
2083
|
+
autoClose?: boolean;
|
|
2084
|
+
emitClose?: boolean;
|
|
2085
|
+
start?: number;
|
|
2086
|
+
highWaterMark?: number;
|
|
2100
2087
|
}): WriteStream;
|
|
2101
2088
|
|
|
2102
2089
|
/**
|
|
@@ -2231,23 +2218,23 @@ declare module 'fs' {
|
|
|
2231
2218
|
export function readvSync(fd: number, buffers: ReadonlyArray<NodeJS.ArrayBufferView>, position?: number): number;
|
|
2232
2219
|
|
|
2233
2220
|
export interface OpenDirOptions {
|
|
2234
|
-
encoding?: BufferEncoding
|
|
2221
|
+
encoding?: BufferEncoding;
|
|
2235
2222
|
/**
|
|
2236
2223
|
* Number of directory entries that are buffered
|
|
2237
2224
|
* internally when reading from the directory. Higher values lead to better
|
|
2238
2225
|
* performance but higher memory usage.
|
|
2239
2226
|
* @default 32
|
|
2240
2227
|
*/
|
|
2241
|
-
bufferSize?: number
|
|
2228
|
+
bufferSize?: number;
|
|
2242
2229
|
}
|
|
2243
2230
|
|
|
2244
|
-
export function opendirSync(path:
|
|
2231
|
+
export function opendirSync(path: string, options?: OpenDirOptions): Dir;
|
|
2245
2232
|
|
|
2246
|
-
export function opendir(path:
|
|
2247
|
-
export function opendir(path:
|
|
2233
|
+
export function opendir(path: string, cb: (err: NodeJS.ErrnoException | null, dir: Dir) => void): void;
|
|
2234
|
+
export function opendir(path: string, options: OpenDirOptions, cb: (err: NodeJS.ErrnoException | null, dir: Dir) => void): void;
|
|
2248
2235
|
|
|
2249
2236
|
export namespace opendir {
|
|
2250
|
-
function __promisify__(path:
|
|
2237
|
+
function __promisify__(path: string, options?: OpenDirOptions): Promise<Dir>;
|
|
2251
2238
|
}
|
|
2252
2239
|
|
|
2253
2240
|
export interface BigIntStats extends StatsBase<bigint> {
|
|
@@ -2265,9 +2252,6 @@ declare module 'fs' {
|
|
|
2265
2252
|
}
|
|
2266
2253
|
|
|
2267
2254
|
export interface StatOptions {
|
|
2268
|
-
bigint?: boolean
|
|
2255
|
+
bigint?: boolean;
|
|
2269
2256
|
}
|
|
2270
2257
|
}
|
|
2271
|
-
declare module 'node:fs' {
|
|
2272
|
-
export * from 'fs';
|
|
2273
|
-
}
|