@types/node 22.15.33 → 24.10.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 v24.10/README.md +15 -0
- node v24.10/assert/strict.d.ts +111 -0
- {node v22.15 → node v24.10}/assert.d.ts +162 -101
- {node v22.15 → node v24.10}/async_hooks.d.ts +26 -6
- {node v22.15 → node v24.10}/buffer.buffer.d.ts +9 -0
- {node v22.15 → node v24.10}/buffer.d.ts +15 -7
- {node v22.15 → node v24.10}/child_process.d.ts +91 -164
- {node v22.15 → node v24.10}/cluster.d.ts +19 -20
- {node v22.15 → node v24.10}/compatibility/iterators.d.ts +1 -0
- {node v22.15 → node v24.10}/console.d.ts +19 -18
- {node v22.15 → node v24.10}/crypto.d.ts +1264 -356
- {node v22.15 → node v24.10}/dgram.d.ts +10 -9
- {node v22.15 → node v24.10}/diagnostics_channel.d.ts +1 -3
- {node v22.15 → node v24.10}/dns/promises.d.ts +12 -11
- {node v22.15 → node v24.10}/dns.d.ts +41 -37
- {node v22.15 → node v24.10}/domain.d.ts +1 -1
- {node v22.15 → node v24.10}/events.d.ts +81 -36
- {node v22.15 → node v24.10}/fs/promises.d.ts +101 -57
- {node v22.15 → node v24.10}/fs.d.ts +413 -136
- node v24.10/globals.d.ts +170 -0
- node v24.10/globals.typedarray.d.ts +41 -0
- {node v22.15 → node v24.10}/http.d.ts +187 -37
- {node v22.15 → node v24.10}/http2.d.ts +197 -66
- {node v22.15 → node v24.10}/https.d.ts +97 -63
- {node v22.15 → node v24.10}/index.d.ts +16 -7
- node v24.10/inspector.d.ts +277 -0
- node v22.15/inspector.d.ts → node v24.10/inspector.generated.d.ts +1059 -828
- {node v22.15 → node v24.10}/module.d.ts +90 -30
- {node v22.15 → node v24.10}/net.d.ts +35 -16
- {node v22.15 → node v24.10}/os.d.ts +22 -10
- {node v22.15 → node v24.10}/package.json +14 -84
- {node v22.15 → node v24.10}/path.d.ts +2 -2
- {node v22.15 → node v24.10}/perf_hooks.d.ts +28 -16
- {node v22.15 → node v24.10}/process.d.ts +40 -34
- {node v22.15 → node v24.10}/punycode.d.ts +1 -1
- {node v22.15 → node v24.10}/querystring.d.ts +1 -1
- {node v22.15 → node v24.10}/readline/promises.d.ts +1 -2
- {node v22.15 → node v24.10}/readline.d.ts +13 -13
- {node v22.15 → node v24.10}/repl.d.ts +25 -17
- {node v22.15 → node v24.10}/sea.d.ts +10 -1
- {node v22.15 → node v24.10}/sqlite.d.ts +438 -9
- {node v22.15 → node v24.10}/stream/consumers.d.ts +2 -2
- {node v22.15 → node v24.10}/stream/web.d.ts +13 -54
- {node v22.15 → node v24.10}/stream.d.ts +63 -48
- {node v22.15 → node v24.10}/string_decoder.d.ts +3 -3
- node v24.10/test.d.ts +2339 -0
- {node v22.15 → node v24.10}/timers/promises.d.ts +1 -1
- {node v22.15 → node v24.10}/timers.d.ts +1 -3
- {node v22.15 → node v24.10}/tls.d.ts +124 -114
- {node v22.15 → node v24.10}/trace_events.d.ts +6 -6
- {node v22.15 → node v24.10}/ts5.6/buffer.buffer.d.ts +10 -2
- node v24.10/ts5.6/compatibility/float16array.d.ts +71 -0
- node v24.10/ts5.6/globals.typedarray.d.ts +36 -0
- {node v22.15 → node v24.10}/ts5.6/index.d.ts +18 -7
- node v24.10/ts5.7/compatibility/float16array.d.ts +72 -0
- node v24.10/ts5.7/index.d.ts +103 -0
- {node v22.15 → node v24.10}/tty.d.ts +1 -1
- {node v22.15 → node v24.10}/url.d.ts +119 -34
- {node v22.15 → node v24.10}/util.d.ts +45 -304
- {node v22.15 → node v24.10}/v8.d.ts +68 -38
- {node v22.15 → node v24.10}/vm.d.ts +258 -107
- {node v22.15 → node v24.10}/wasi.d.ts +23 -2
- node v24.10/web-globals/abortcontroller.d.ts +34 -0
- node v24.10/web-globals/crypto.d.ts +32 -0
- node v24.10/web-globals/domexception.d.ts +68 -0
- node v22.15/dom-events.d.ts → node v24.10/web-globals/events.d.ts +49 -51
- node v24.10/web-globals/fetch.d.ts +50 -0
- node v24.10/web-globals/navigator.d.ts +25 -0
- node v24.10/web-globals/storage.d.ts +24 -0
- node v24.10/web-globals/streams.d.ts +22 -0
- {node v22.15 → node v24.10}/worker_threads.d.ts +206 -68
- {node v22.15 → node v24.10}/zlib.d.ts +44 -33
- node v22.15/README.md +0 -15
- node v22.15/assert/strict.d.ts +0 -8
- node v22.15/compatibility/disposable.d.ts +0 -14
- node v22.15/compatibility/index.d.ts +0 -9
- node v22.15/compatibility/indexable.d.ts +0 -20
- node v22.15/globals.d.ts +0 -364
- node v22.15/globals.typedarray.d.ts +0 -21
- node v22.15/test.d.ts +0 -2278
- node v22.15/ts5.6/globals.typedarray.d.ts +0 -19
- {node v22.15 → node v24.10}/LICENSE +0 -0
- {node v22.15 → node v24.10}/constants.d.ts +0 -0
- {node v22.15 → node v24.10}/stream/promises.d.ts +0 -0
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
* @since v10.0.0
|
|
10
10
|
*/
|
|
11
11
|
declare module "fs/promises" {
|
|
12
|
+
import { NonSharedBuffer } from "node:buffer";
|
|
12
13
|
import { Abortable } from "node:events";
|
|
13
14
|
import { Stream } from "node:stream";
|
|
14
15
|
import { ReadableStream } from "node:stream/web";
|
|
@@ -20,6 +21,8 @@ declare module "fs/promises" {
|
|
|
20
21
|
CopyOptions,
|
|
21
22
|
Dir,
|
|
22
23
|
Dirent,
|
|
24
|
+
DisposableTempDir,
|
|
25
|
+
EncodingOption,
|
|
23
26
|
GlobOptions,
|
|
24
27
|
GlobOptionsWithFileTypes,
|
|
25
28
|
GlobOptionsWithoutFileTypes,
|
|
@@ -29,6 +32,8 @@ declare module "fs/promises" {
|
|
|
29
32
|
OpenDirOptions,
|
|
30
33
|
OpenMode,
|
|
31
34
|
PathLike,
|
|
35
|
+
ReadOptions,
|
|
36
|
+
ReadOptionsWithBuffer,
|
|
32
37
|
ReadPosition,
|
|
33
38
|
ReadStream,
|
|
34
39
|
ReadVResult,
|
|
@@ -40,7 +45,7 @@ declare module "fs/promises" {
|
|
|
40
45
|
StatsFs,
|
|
41
46
|
TimeLike,
|
|
42
47
|
WatchEventType,
|
|
43
|
-
WatchOptions,
|
|
48
|
+
WatchOptions as _WatchOptions,
|
|
44
49
|
WriteStream,
|
|
45
50
|
WriteVResult,
|
|
46
51
|
} from "node:fs";
|
|
@@ -57,6 +62,7 @@ declare module "fs/promises" {
|
|
|
57
62
|
bytesRead: number;
|
|
58
63
|
buffer: T;
|
|
59
64
|
}
|
|
65
|
+
/** @deprecated This interface will be removed in a future version. Use `import { ReadOptionsWithBuffer } from "node:fs"` instead. */
|
|
60
66
|
interface FileReadOptions<T extends NodeJS.ArrayBufferView = Buffer> {
|
|
61
67
|
/**
|
|
62
68
|
* @default `Buffer.alloc(0xffff)`
|
|
@@ -88,6 +94,9 @@ declare module "fs/promises" {
|
|
|
88
94
|
highWaterMark?: number | undefined;
|
|
89
95
|
flush?: boolean | undefined;
|
|
90
96
|
}
|
|
97
|
+
interface ReadableWebStreamOptions {
|
|
98
|
+
autoClose?: boolean | undefined;
|
|
99
|
+
}
|
|
91
100
|
// TODO: Add `EventEmitter` close
|
|
92
101
|
interface FileHandle {
|
|
93
102
|
/**
|
|
@@ -232,11 +241,13 @@ declare module "fs/promises" {
|
|
|
232
241
|
length?: number | null,
|
|
233
242
|
position?: ReadPosition | null,
|
|
234
243
|
): Promise<FileReadResult<T>>;
|
|
235
|
-
read<T extends NodeJS.ArrayBufferView
|
|
244
|
+
read<T extends NodeJS.ArrayBufferView>(
|
|
236
245
|
buffer: T,
|
|
237
|
-
options?:
|
|
246
|
+
options?: ReadOptions,
|
|
247
|
+
): Promise<FileReadResult<T>>;
|
|
248
|
+
read<T extends NodeJS.ArrayBufferView = NonSharedBuffer>(
|
|
249
|
+
options?: ReadOptionsWithBuffer<T>,
|
|
238
250
|
): Promise<FileReadResult<T>>;
|
|
239
|
-
read<T extends NodeJS.ArrayBufferView = Buffer>(options?: FileReadOptions<T>): Promise<FileReadResult<T>>;
|
|
240
251
|
/**
|
|
241
252
|
* Returns a byte-oriented `ReadableStream` that may be used to read the file's
|
|
242
253
|
* contents.
|
|
@@ -260,9 +271,8 @@ declare module "fs/promises" {
|
|
|
260
271
|
* While the `ReadableStream` will read the file to completion, it will not
|
|
261
272
|
* close the `FileHandle` automatically. User code must still call the`fileHandle.close()` method.
|
|
262
273
|
* @since v17.0.0
|
|
263
|
-
* @experimental
|
|
264
274
|
*/
|
|
265
|
-
readableWebStream(): ReadableStream;
|
|
275
|
+
readableWebStream(options?: ReadableWebStreamOptions): ReadableStream;
|
|
266
276
|
/**
|
|
267
277
|
* Asynchronously reads the entire contents of a file.
|
|
268
278
|
*
|
|
@@ -281,7 +291,7 @@ declare module "fs/promises" {
|
|
|
281
291
|
options?:
|
|
282
292
|
| ({ encoding?: null | undefined } & Abortable)
|
|
283
293
|
| null,
|
|
284
|
-
): Promise<
|
|
294
|
+
): Promise<NonSharedBuffer>;
|
|
285
295
|
/**
|
|
286
296
|
* Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically.
|
|
287
297
|
* The `FileHandle` must have been opened for reading.
|
|
@@ -300,7 +310,7 @@ declare module "fs/promises" {
|
|
|
300
310
|
| (ObjectEncodingOptions & Abortable)
|
|
301
311
|
| BufferEncoding
|
|
302
312
|
| null,
|
|
303
|
-
): Promise<string |
|
|
313
|
+
): Promise<string | NonSharedBuffer>;
|
|
304
314
|
/**
|
|
305
315
|
* Convenience method to create a `readline` interface and stream over the file.
|
|
306
316
|
* See `filehandle.createReadStream()` for the options.
|
|
@@ -409,7 +419,7 @@ declare module "fs/promises" {
|
|
|
409
419
|
* @param [position='null'] The offset from the beginning of the file where the data from `buffer` should be written. If `position` is not a `number`, the data will be written at the current
|
|
410
420
|
* position. See the POSIX pwrite(2) documentation for more detail.
|
|
411
421
|
*/
|
|
412
|
-
write<TBuffer extends
|
|
422
|
+
write<TBuffer extends NodeJS.ArrayBufferView>(
|
|
413
423
|
buffer: TBuffer,
|
|
414
424
|
offset?: number | null,
|
|
415
425
|
length?: number | null,
|
|
@@ -448,14 +458,20 @@ declare module "fs/promises" {
|
|
|
448
458
|
* @param [position='null'] The offset from the beginning of the file where the data from `buffers` should be written. If `position` is not a `number`, the data will be written at the current
|
|
449
459
|
* position.
|
|
450
460
|
*/
|
|
451
|
-
writev
|
|
461
|
+
writev<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
|
|
462
|
+
buffers: TBuffers,
|
|
463
|
+
position?: number,
|
|
464
|
+
): Promise<WriteVResult<TBuffers>>;
|
|
452
465
|
/**
|
|
453
466
|
* Read from a file and write to an array of [ArrayBufferView](https://developer.mozilla.org/en-US/docs/Web/API/ArrayBufferView) s
|
|
454
467
|
* @since v13.13.0, v12.17.0
|
|
455
468
|
* @param [position='null'] The offset from the beginning of the file where the data should be read from. If `position` is not a `number`, the data will be read from the current position.
|
|
456
469
|
* @return Fulfills upon success an object containing two properties:
|
|
457
470
|
*/
|
|
458
|
-
readv
|
|
471
|
+
readv<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
|
|
472
|
+
buffers: TBuffers,
|
|
473
|
+
position?: number,
|
|
474
|
+
): Promise<ReadVResult<TBuffers>>;
|
|
459
475
|
/**
|
|
460
476
|
* Closes the file handle after waiting for any pending operation on the handle to
|
|
461
477
|
* complete.
|
|
@@ -475,8 +491,9 @@ declare module "fs/promises" {
|
|
|
475
491
|
*/
|
|
476
492
|
close(): Promise<void>;
|
|
477
493
|
/**
|
|
478
|
-
*
|
|
479
|
-
*
|
|
494
|
+
* Calls `filehandle.close()` and returns a promise that fulfills when the
|
|
495
|
+
* filehandle is closed.
|
|
496
|
+
* @since v20.4.0, v18.8.0
|
|
480
497
|
*/
|
|
481
498
|
[Symbol.asyncDispose](): Promise<void>;
|
|
482
499
|
}
|
|
@@ -691,7 +708,7 @@ declare module "fs/promises" {
|
|
|
691
708
|
recursive?: boolean | undefined;
|
|
692
709
|
}
|
|
693
710
|
| "buffer",
|
|
694
|
-
): Promise<
|
|
711
|
+
): Promise<NonSharedBuffer[]>;
|
|
695
712
|
/**
|
|
696
713
|
* Asynchronous readdir(3) - read a directory.
|
|
697
714
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
@@ -706,7 +723,7 @@ declare module "fs/promises" {
|
|
|
706
723
|
})
|
|
707
724
|
| BufferEncoding
|
|
708
725
|
| null,
|
|
709
|
-
): Promise<string[] |
|
|
726
|
+
): Promise<string[] | NonSharedBuffer[]>;
|
|
710
727
|
/**
|
|
711
728
|
* Asynchronous readdir(3) - read a directory.
|
|
712
729
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
@@ -731,7 +748,7 @@ declare module "fs/promises" {
|
|
|
731
748
|
withFileTypes: true;
|
|
732
749
|
recursive?: boolean | undefined;
|
|
733
750
|
},
|
|
734
|
-
): Promise<Dirent<
|
|
751
|
+
): Promise<Dirent<NonSharedBuffer>[]>;
|
|
735
752
|
/**
|
|
736
753
|
* Reads the contents of the symbolic link referred to by `path`. See the POSIX [`readlink(2)`](http://man7.org/linux/man-pages/man2/readlink.2.html) documentation for more detail. The promise is
|
|
737
754
|
* fulfilled with the`linkString` upon success.
|
|
@@ -749,13 +766,16 @@ declare module "fs/promises" {
|
|
|
749
766
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
750
767
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
751
768
|
*/
|
|
752
|
-
function readlink(path: PathLike, options: BufferEncodingOption): Promise<
|
|
769
|
+
function readlink(path: PathLike, options: BufferEncodingOption): Promise<NonSharedBuffer>;
|
|
753
770
|
/**
|
|
754
771
|
* Asynchronous readlink(2) - read value of a symbolic link.
|
|
755
772
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
756
773
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
757
774
|
*/
|
|
758
|
-
function readlink(
|
|
775
|
+
function readlink(
|
|
776
|
+
path: PathLike,
|
|
777
|
+
options?: ObjectEncodingOptions | string | null,
|
|
778
|
+
): Promise<string | NonSharedBuffer>;
|
|
759
779
|
/**
|
|
760
780
|
* Creates a symbolic link.
|
|
761
781
|
*
|
|
@@ -906,7 +926,7 @@ declare module "fs/promises" {
|
|
|
906
926
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
907
927
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
908
928
|
*/
|
|
909
|
-
function realpath(path: PathLike, options: BufferEncodingOption): Promise<
|
|
929
|
+
function realpath(path: PathLike, options: BufferEncodingOption): Promise<NonSharedBuffer>;
|
|
910
930
|
/**
|
|
911
931
|
* Asynchronous realpath(3) - return the canonicalized absolute pathname.
|
|
912
932
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
@@ -915,7 +935,7 @@ declare module "fs/promises" {
|
|
|
915
935
|
function realpath(
|
|
916
936
|
path: PathLike,
|
|
917
937
|
options?: ObjectEncodingOptions | BufferEncoding | null,
|
|
918
|
-
): Promise<string |
|
|
938
|
+
): Promise<string | NonSharedBuffer>;
|
|
919
939
|
/**
|
|
920
940
|
* Creates a unique temporary directory. A unique directory name is generated by
|
|
921
941
|
* appending six random characters to the end of the provided `prefix`. Due to
|
|
@@ -951,13 +971,36 @@ declare module "fs/promises" {
|
|
|
951
971
|
* Generates six random characters to be appended behind a required `prefix` to create a unique temporary directory.
|
|
952
972
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
953
973
|
*/
|
|
954
|
-
function mkdtemp(prefix: string, options: BufferEncodingOption): Promise<
|
|
974
|
+
function mkdtemp(prefix: string, options: BufferEncodingOption): Promise<NonSharedBuffer>;
|
|
955
975
|
/**
|
|
956
976
|
* Asynchronously creates a unique temporary directory.
|
|
957
977
|
* Generates six random characters to be appended behind a required `prefix` to create a unique temporary directory.
|
|
958
978
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
959
979
|
*/
|
|
960
|
-
function mkdtemp(
|
|
980
|
+
function mkdtemp(
|
|
981
|
+
prefix: string,
|
|
982
|
+
options?: ObjectEncodingOptions | BufferEncoding | null,
|
|
983
|
+
): Promise<string | NonSharedBuffer>;
|
|
984
|
+
/**
|
|
985
|
+
* The resulting Promise holds an async-disposable object whose `path` property
|
|
986
|
+
* holds the created directory path. When the object is disposed, the directory
|
|
987
|
+
* and its contents will be removed asynchronously if it still exists. If the
|
|
988
|
+
* directory cannot be deleted, disposal will throw an error. The object has an
|
|
989
|
+
* async `remove()` method which will perform the same task.
|
|
990
|
+
*
|
|
991
|
+
* Both this function and the disposal function on the resulting object are
|
|
992
|
+
* async, so it should be used with `await` + `await using` as in
|
|
993
|
+
* `await using dir = await fsPromises.mkdtempDisposable('prefix')`.
|
|
994
|
+
*
|
|
995
|
+
* <!-- TODO: link MDN docs for disposables once https://github.com/mdn/content/pull/38027 lands -->
|
|
996
|
+
*
|
|
997
|
+
* For detailed information, see the documentation of `fsPromises.mkdtemp()`.
|
|
998
|
+
*
|
|
999
|
+
* The optional `options` argument can be a string specifying an encoding, or an
|
|
1000
|
+
* object with an `encoding` property specifying the character encoding to use.
|
|
1001
|
+
* @since v24.4.0
|
|
1002
|
+
*/
|
|
1003
|
+
function mkdtempDisposable(prefix: PathLike, options?: EncodingOption): Promise<DisposableTempDir>;
|
|
961
1004
|
/**
|
|
962
1005
|
* Asynchronously writes data to a file, replacing the file if it already exists. `data` can be a string, a buffer, an
|
|
963
1006
|
* [AsyncIterable](https://tc39.github.io/ecma262/#sec-asynciterable-interface), or an
|
|
@@ -1113,7 +1156,7 @@ declare module "fs/promises" {
|
|
|
1113
1156
|
flag?: OpenMode | undefined;
|
|
1114
1157
|
} & Abortable)
|
|
1115
1158
|
| null,
|
|
1116
|
-
): Promise<
|
|
1159
|
+
): Promise<NonSharedBuffer>;
|
|
1117
1160
|
/**
|
|
1118
1161
|
* Asynchronously reads the entire contents of a file.
|
|
1119
1162
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
@@ -1149,7 +1192,7 @@ declare module "fs/promises" {
|
|
|
1149
1192
|
)
|
|
1150
1193
|
| BufferEncoding
|
|
1151
1194
|
| null,
|
|
1152
|
-
): Promise<string |
|
|
1195
|
+
): Promise<string | NonSharedBuffer>;
|
|
1153
1196
|
/**
|
|
1154
1197
|
* Asynchronously open a directory for iterative scanning. See the POSIX [`opendir(3)`](http://man7.org/linux/man-pages/man3/opendir.3.html) documentation for more detail.
|
|
1155
1198
|
*
|
|
@@ -1179,6 +1222,16 @@ declare module "fs/promises" {
|
|
|
1179
1222
|
* @return Fulfills with an {fs.Dir}.
|
|
1180
1223
|
*/
|
|
1181
1224
|
function opendir(path: PathLike, options?: OpenDirOptions): Promise<Dir>;
|
|
1225
|
+
interface WatchOptions extends _WatchOptions {
|
|
1226
|
+
maxQueue?: number | undefined;
|
|
1227
|
+
overflow?: "ignore" | "throw" | undefined;
|
|
1228
|
+
}
|
|
1229
|
+
interface WatchOptionsWithBufferEncoding extends WatchOptions {
|
|
1230
|
+
encoding: "buffer";
|
|
1231
|
+
}
|
|
1232
|
+
interface WatchOptionsWithStringEncoding extends WatchOptions {
|
|
1233
|
+
encoding?: BufferEncoding | undefined;
|
|
1234
|
+
}
|
|
1182
1235
|
/**
|
|
1183
1236
|
* Returns an async iterator that watches for changes on `filename`, where `filename`is either a file or a directory.
|
|
1184
1237
|
*
|
|
@@ -1211,33 +1264,16 @@ declare module "fs/promises" {
|
|
|
1211
1264
|
*/
|
|
1212
1265
|
function watch(
|
|
1213
1266
|
filename: PathLike,
|
|
1214
|
-
options
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
):
|
|
1220
|
-
/**
|
|
1221
|
-
* Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`.
|
|
1222
|
-
* @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
|
|
1223
|
-
* @param options Either the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options.
|
|
1224
|
-
* If `encoding` is not supplied, the default of `'utf8'` is used.
|
|
1225
|
-
* If `persistent` is not supplied, the default of `true` is used.
|
|
1226
|
-
* If `recursive` is not supplied, the default of `false` is used.
|
|
1227
|
-
*/
|
|
1228
|
-
function watch(filename: PathLike, options?: WatchOptions | BufferEncoding): AsyncIterable<FileChangeInfo<string>>;
|
|
1229
|
-
/**
|
|
1230
|
-
* Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`.
|
|
1231
|
-
* @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
|
|
1232
|
-
* @param options Either the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options.
|
|
1233
|
-
* If `encoding` is not supplied, the default of `'utf8'` is used.
|
|
1234
|
-
* If `persistent` is not supplied, the default of `true` is used.
|
|
1235
|
-
* If `recursive` is not supplied, the default of `false` is used.
|
|
1236
|
-
*/
|
|
1267
|
+
options?: WatchOptionsWithStringEncoding | BufferEncoding,
|
|
1268
|
+
): NodeJS.AsyncIterator<FileChangeInfo<string>>;
|
|
1269
|
+
function watch(
|
|
1270
|
+
filename: PathLike,
|
|
1271
|
+
options: WatchOptionsWithBufferEncoding | "buffer",
|
|
1272
|
+
): NodeJS.AsyncIterator<FileChangeInfo<NonSharedBuffer>>;
|
|
1237
1273
|
function watch(
|
|
1238
1274
|
filename: PathLike,
|
|
1239
|
-
options: WatchOptions |
|
|
1240
|
-
):
|
|
1275
|
+
options: WatchOptions | BufferEncoding | "buffer",
|
|
1276
|
+
): NodeJS.AsyncIterator<FileChangeInfo<string | NonSharedBuffer>>;
|
|
1241
1277
|
/**
|
|
1242
1278
|
* Asynchronously copies the entire directory structure from `src` to `dest`,
|
|
1243
1279
|
* including subdirectories and files.
|
|
@@ -1252,20 +1288,28 @@ declare module "fs/promises" {
|
|
|
1252
1288
|
*/
|
|
1253
1289
|
function cp(source: string | URL, destination: string | URL, opts?: CopyOptions): Promise<void>;
|
|
1254
1290
|
/**
|
|
1255
|
-
*
|
|
1291
|
+
* ```js
|
|
1292
|
+
* import { glob } from 'node:fs/promises';
|
|
1293
|
+
*
|
|
1294
|
+
* for await (const entry of glob('*.js'))
|
|
1295
|
+
* console.log(entry);
|
|
1296
|
+
* ```
|
|
1297
|
+
* @since v22.0.0
|
|
1298
|
+
* @returns An AsyncIterator that yields the paths of files
|
|
1299
|
+
* that match the pattern.
|
|
1256
1300
|
*/
|
|
1257
|
-
function glob(pattern: string | string[]): NodeJS.AsyncIterator<string>;
|
|
1301
|
+
function glob(pattern: string | readonly string[]): NodeJS.AsyncIterator<string>;
|
|
1258
1302
|
function glob(
|
|
1259
|
-
pattern: string | string[],
|
|
1260
|
-
|
|
1303
|
+
pattern: string | readonly string[],
|
|
1304
|
+
options: GlobOptionsWithFileTypes,
|
|
1261
1305
|
): NodeJS.AsyncIterator<Dirent>;
|
|
1262
1306
|
function glob(
|
|
1263
|
-
pattern: string | string[],
|
|
1264
|
-
|
|
1307
|
+
pattern: string | readonly string[],
|
|
1308
|
+
options: GlobOptionsWithoutFileTypes,
|
|
1265
1309
|
): NodeJS.AsyncIterator<string>;
|
|
1266
1310
|
function glob(
|
|
1267
|
-
pattern: string | string[],
|
|
1268
|
-
|
|
1311
|
+
pattern: string | readonly string[],
|
|
1312
|
+
options: GlobOptions,
|
|
1269
1313
|
): NodeJS.AsyncIterator<Dirent | string>;
|
|
1270
1314
|
}
|
|
1271
1315
|
declare module "node:fs/promises" {
|