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