@types/node 22.15.33 → 24.10.9
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 +114 -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 +59 -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 +128 -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,7 @@ declare module "fs/promises" {
|
|
|
20
21
|
CopyOptions,
|
|
21
22
|
Dir,
|
|
22
23
|
Dirent,
|
|
24
|
+
EncodingOption,
|
|
23
25
|
GlobOptions,
|
|
24
26
|
GlobOptionsWithFileTypes,
|
|
25
27
|
GlobOptionsWithoutFileTypes,
|
|
@@ -29,6 +31,8 @@ declare module "fs/promises" {
|
|
|
29
31
|
OpenDirOptions,
|
|
30
32
|
OpenMode,
|
|
31
33
|
PathLike,
|
|
34
|
+
ReadOptions,
|
|
35
|
+
ReadOptionsWithBuffer,
|
|
32
36
|
ReadPosition,
|
|
33
37
|
ReadStream,
|
|
34
38
|
ReadVResult,
|
|
@@ -40,7 +44,7 @@ declare module "fs/promises" {
|
|
|
40
44
|
StatsFs,
|
|
41
45
|
TimeLike,
|
|
42
46
|
WatchEventType,
|
|
43
|
-
WatchOptions,
|
|
47
|
+
WatchOptions as _WatchOptions,
|
|
44
48
|
WriteStream,
|
|
45
49
|
WriteVResult,
|
|
46
50
|
} from "node:fs";
|
|
@@ -57,6 +61,7 @@ declare module "fs/promises" {
|
|
|
57
61
|
bytesRead: number;
|
|
58
62
|
buffer: T;
|
|
59
63
|
}
|
|
64
|
+
/** @deprecated This interface will be removed in a future version. Use `import { ReadOptionsWithBuffer } from "node:fs"` instead. */
|
|
60
65
|
interface FileReadOptions<T extends NodeJS.ArrayBufferView = Buffer> {
|
|
61
66
|
/**
|
|
62
67
|
* @default `Buffer.alloc(0xffff)`
|
|
@@ -88,6 +93,9 @@ declare module "fs/promises" {
|
|
|
88
93
|
highWaterMark?: number | undefined;
|
|
89
94
|
flush?: boolean | undefined;
|
|
90
95
|
}
|
|
96
|
+
interface ReadableWebStreamOptions {
|
|
97
|
+
autoClose?: boolean | undefined;
|
|
98
|
+
}
|
|
91
99
|
// TODO: Add `EventEmitter` close
|
|
92
100
|
interface FileHandle {
|
|
93
101
|
/**
|
|
@@ -232,11 +240,13 @@ declare module "fs/promises" {
|
|
|
232
240
|
length?: number | null,
|
|
233
241
|
position?: ReadPosition | null,
|
|
234
242
|
): Promise<FileReadResult<T>>;
|
|
235
|
-
read<T extends NodeJS.ArrayBufferView
|
|
243
|
+
read<T extends NodeJS.ArrayBufferView>(
|
|
236
244
|
buffer: T,
|
|
237
|
-
options?:
|
|
245
|
+
options?: ReadOptions,
|
|
246
|
+
): Promise<FileReadResult<T>>;
|
|
247
|
+
read<T extends NodeJS.ArrayBufferView = NonSharedBuffer>(
|
|
248
|
+
options?: ReadOptionsWithBuffer<T>,
|
|
238
249
|
): Promise<FileReadResult<T>>;
|
|
239
|
-
read<T extends NodeJS.ArrayBufferView = Buffer>(options?: FileReadOptions<T>): Promise<FileReadResult<T>>;
|
|
240
250
|
/**
|
|
241
251
|
* Returns a byte-oriented `ReadableStream` that may be used to read the file's
|
|
242
252
|
* contents.
|
|
@@ -260,9 +270,8 @@ declare module "fs/promises" {
|
|
|
260
270
|
* While the `ReadableStream` will read the file to completion, it will not
|
|
261
271
|
* close the `FileHandle` automatically. User code must still call the`fileHandle.close()` method.
|
|
262
272
|
* @since v17.0.0
|
|
263
|
-
* @experimental
|
|
264
273
|
*/
|
|
265
|
-
readableWebStream(): ReadableStream;
|
|
274
|
+
readableWebStream(options?: ReadableWebStreamOptions): ReadableStream;
|
|
266
275
|
/**
|
|
267
276
|
* Asynchronously reads the entire contents of a file.
|
|
268
277
|
*
|
|
@@ -281,7 +290,7 @@ declare module "fs/promises" {
|
|
|
281
290
|
options?:
|
|
282
291
|
| ({ encoding?: null | undefined } & Abortable)
|
|
283
292
|
| null,
|
|
284
|
-
): Promise<
|
|
293
|
+
): Promise<NonSharedBuffer>;
|
|
285
294
|
/**
|
|
286
295
|
* Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically.
|
|
287
296
|
* The `FileHandle` must have been opened for reading.
|
|
@@ -300,7 +309,7 @@ declare module "fs/promises" {
|
|
|
300
309
|
| (ObjectEncodingOptions & Abortable)
|
|
301
310
|
| BufferEncoding
|
|
302
311
|
| null,
|
|
303
|
-
): Promise<string |
|
|
312
|
+
): Promise<string | NonSharedBuffer>;
|
|
304
313
|
/**
|
|
305
314
|
* Convenience method to create a `readline` interface and stream over the file.
|
|
306
315
|
* See `filehandle.createReadStream()` for the options.
|
|
@@ -409,7 +418,7 @@ declare module "fs/promises" {
|
|
|
409
418
|
* @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
419
|
* position. See the POSIX pwrite(2) documentation for more detail.
|
|
411
420
|
*/
|
|
412
|
-
write<TBuffer extends
|
|
421
|
+
write<TBuffer extends NodeJS.ArrayBufferView>(
|
|
413
422
|
buffer: TBuffer,
|
|
414
423
|
offset?: number | null,
|
|
415
424
|
length?: number | null,
|
|
@@ -448,14 +457,20 @@ declare module "fs/promises" {
|
|
|
448
457
|
* @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
458
|
* position.
|
|
450
459
|
*/
|
|
451
|
-
writev
|
|
460
|
+
writev<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
|
|
461
|
+
buffers: TBuffers,
|
|
462
|
+
position?: number,
|
|
463
|
+
): Promise<WriteVResult<TBuffers>>;
|
|
452
464
|
/**
|
|
453
465
|
* Read from a file and write to an array of [ArrayBufferView](https://developer.mozilla.org/en-US/docs/Web/API/ArrayBufferView) s
|
|
454
466
|
* @since v13.13.0, v12.17.0
|
|
455
467
|
* @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
468
|
* @return Fulfills upon success an object containing two properties:
|
|
457
469
|
*/
|
|
458
|
-
readv
|
|
470
|
+
readv<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
|
|
471
|
+
buffers: TBuffers,
|
|
472
|
+
position?: number,
|
|
473
|
+
): Promise<ReadVResult<TBuffers>>;
|
|
459
474
|
/**
|
|
460
475
|
* Closes the file handle after waiting for any pending operation on the handle to
|
|
461
476
|
* complete.
|
|
@@ -475,8 +490,9 @@ declare module "fs/promises" {
|
|
|
475
490
|
*/
|
|
476
491
|
close(): Promise<void>;
|
|
477
492
|
/**
|
|
478
|
-
*
|
|
479
|
-
*
|
|
493
|
+
* Calls `filehandle.close()` and returns a promise that fulfills when the
|
|
494
|
+
* filehandle is closed.
|
|
495
|
+
* @since v20.4.0, v18.8.0
|
|
480
496
|
*/
|
|
481
497
|
[Symbol.asyncDispose](): Promise<void>;
|
|
482
498
|
}
|
|
@@ -691,7 +707,7 @@ declare module "fs/promises" {
|
|
|
691
707
|
recursive?: boolean | undefined;
|
|
692
708
|
}
|
|
693
709
|
| "buffer",
|
|
694
|
-
): Promise<
|
|
710
|
+
): Promise<NonSharedBuffer[]>;
|
|
695
711
|
/**
|
|
696
712
|
* Asynchronous readdir(3) - read a directory.
|
|
697
713
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
@@ -706,7 +722,7 @@ declare module "fs/promises" {
|
|
|
706
722
|
})
|
|
707
723
|
| BufferEncoding
|
|
708
724
|
| null,
|
|
709
|
-
): Promise<string[] |
|
|
725
|
+
): Promise<string[] | NonSharedBuffer[]>;
|
|
710
726
|
/**
|
|
711
727
|
* Asynchronous readdir(3) - read a directory.
|
|
712
728
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
@@ -731,7 +747,7 @@ declare module "fs/promises" {
|
|
|
731
747
|
withFileTypes: true;
|
|
732
748
|
recursive?: boolean | undefined;
|
|
733
749
|
},
|
|
734
|
-
): Promise<Dirent<
|
|
750
|
+
): Promise<Dirent<NonSharedBuffer>[]>;
|
|
735
751
|
/**
|
|
736
752
|
* 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
753
|
* fulfilled with the`linkString` upon success.
|
|
@@ -749,13 +765,16 @@ declare module "fs/promises" {
|
|
|
749
765
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
750
766
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
751
767
|
*/
|
|
752
|
-
function readlink(path: PathLike, options: BufferEncodingOption): Promise<
|
|
768
|
+
function readlink(path: PathLike, options: BufferEncodingOption): Promise<NonSharedBuffer>;
|
|
753
769
|
/**
|
|
754
770
|
* Asynchronous readlink(2) - read value of a symbolic link.
|
|
755
771
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
756
772
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
757
773
|
*/
|
|
758
|
-
function readlink(
|
|
774
|
+
function readlink(
|
|
775
|
+
path: PathLike,
|
|
776
|
+
options?: ObjectEncodingOptions | string | null,
|
|
777
|
+
): Promise<string | NonSharedBuffer>;
|
|
759
778
|
/**
|
|
760
779
|
* Creates a symbolic link.
|
|
761
780
|
*
|
|
@@ -906,7 +925,7 @@ declare module "fs/promises" {
|
|
|
906
925
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
907
926
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
908
927
|
*/
|
|
909
|
-
function realpath(path: PathLike, options: BufferEncodingOption): Promise<
|
|
928
|
+
function realpath(path: PathLike, options: BufferEncodingOption): Promise<NonSharedBuffer>;
|
|
910
929
|
/**
|
|
911
930
|
* Asynchronous realpath(3) - return the canonicalized absolute pathname.
|
|
912
931
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
@@ -915,7 +934,7 @@ declare module "fs/promises" {
|
|
|
915
934
|
function realpath(
|
|
916
935
|
path: PathLike,
|
|
917
936
|
options?: ObjectEncodingOptions | BufferEncoding | null,
|
|
918
|
-
): Promise<string |
|
|
937
|
+
): Promise<string | NonSharedBuffer>;
|
|
919
938
|
/**
|
|
920
939
|
* Creates a unique temporary directory. A unique directory name is generated by
|
|
921
940
|
* appending six random characters to the end of the provided `prefix`. Due to
|
|
@@ -951,13 +970,50 @@ declare module "fs/promises" {
|
|
|
951
970
|
* Generates six random characters to be appended behind a required `prefix` to create a unique temporary directory.
|
|
952
971
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
953
972
|
*/
|
|
954
|
-
function mkdtemp(prefix: string, options: BufferEncodingOption): Promise<
|
|
973
|
+
function mkdtemp(prefix: string, options: BufferEncodingOption): Promise<NonSharedBuffer>;
|
|
955
974
|
/**
|
|
956
975
|
* Asynchronously creates a unique temporary directory.
|
|
957
976
|
* Generates six random characters to be appended behind a required `prefix` to create a unique temporary directory.
|
|
958
977
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
959
978
|
*/
|
|
960
|
-
function mkdtemp(
|
|
979
|
+
function mkdtemp(
|
|
980
|
+
prefix: string,
|
|
981
|
+
options?: ObjectEncodingOptions | BufferEncoding | null,
|
|
982
|
+
): Promise<string | NonSharedBuffer>;
|
|
983
|
+
interface DisposableTempDir extends AsyncDisposable {
|
|
984
|
+
/**
|
|
985
|
+
* The path of the created directory.
|
|
986
|
+
*/
|
|
987
|
+
path: string;
|
|
988
|
+
/**
|
|
989
|
+
* A function which removes the created directory.
|
|
990
|
+
*/
|
|
991
|
+
remove(): Promise<void>;
|
|
992
|
+
/**
|
|
993
|
+
* The same as `remove`.
|
|
994
|
+
*/
|
|
995
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
996
|
+
}
|
|
997
|
+
/**
|
|
998
|
+
* The resulting Promise holds an async-disposable object whose `path` property
|
|
999
|
+
* holds the created directory path. When the object is disposed, the directory
|
|
1000
|
+
* and its contents will be removed asynchronously if it still exists. If the
|
|
1001
|
+
* directory cannot be deleted, disposal will throw an error. The object has an
|
|
1002
|
+
* async `remove()` method which will perform the same task.
|
|
1003
|
+
*
|
|
1004
|
+
* Both this function and the disposal function on the resulting object are
|
|
1005
|
+
* async, so it should be used with `await` + `await using` as in
|
|
1006
|
+
* `await using dir = await fsPromises.mkdtempDisposable('prefix')`.
|
|
1007
|
+
*
|
|
1008
|
+
* <!-- TODO: link MDN docs for disposables once https://github.com/mdn/content/pull/38027 lands -->
|
|
1009
|
+
*
|
|
1010
|
+
* For detailed information, see the documentation of `fsPromises.mkdtemp()`.
|
|
1011
|
+
*
|
|
1012
|
+
* The optional `options` argument can be a string specifying an encoding, or an
|
|
1013
|
+
* object with an `encoding` property specifying the character encoding to use.
|
|
1014
|
+
* @since v24.4.0
|
|
1015
|
+
*/
|
|
1016
|
+
function mkdtempDisposable(prefix: PathLike, options?: EncodingOption): Promise<DisposableTempDir>;
|
|
961
1017
|
/**
|
|
962
1018
|
* Asynchronously writes data to a file, replacing the file if it already exists. `data` can be a string, a buffer, an
|
|
963
1019
|
* [AsyncIterable](https://tc39.github.io/ecma262/#sec-asynciterable-interface), or an
|
|
@@ -1113,7 +1169,7 @@ declare module "fs/promises" {
|
|
|
1113
1169
|
flag?: OpenMode | undefined;
|
|
1114
1170
|
} & Abortable)
|
|
1115
1171
|
| null,
|
|
1116
|
-
): Promise<
|
|
1172
|
+
): Promise<NonSharedBuffer>;
|
|
1117
1173
|
/**
|
|
1118
1174
|
* Asynchronously reads the entire contents of a file.
|
|
1119
1175
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
@@ -1149,7 +1205,7 @@ declare module "fs/promises" {
|
|
|
1149
1205
|
)
|
|
1150
1206
|
| BufferEncoding
|
|
1151
1207
|
| null,
|
|
1152
|
-
): Promise<string |
|
|
1208
|
+
): Promise<string | NonSharedBuffer>;
|
|
1153
1209
|
/**
|
|
1154
1210
|
* 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
1211
|
*
|
|
@@ -1179,6 +1235,16 @@ declare module "fs/promises" {
|
|
|
1179
1235
|
* @return Fulfills with an {fs.Dir}.
|
|
1180
1236
|
*/
|
|
1181
1237
|
function opendir(path: PathLike, options?: OpenDirOptions): Promise<Dir>;
|
|
1238
|
+
interface WatchOptions extends _WatchOptions {
|
|
1239
|
+
maxQueue?: number | undefined;
|
|
1240
|
+
overflow?: "ignore" | "throw" | undefined;
|
|
1241
|
+
}
|
|
1242
|
+
interface WatchOptionsWithBufferEncoding extends WatchOptions {
|
|
1243
|
+
encoding: "buffer";
|
|
1244
|
+
}
|
|
1245
|
+
interface WatchOptionsWithStringEncoding extends WatchOptions {
|
|
1246
|
+
encoding?: BufferEncoding | undefined;
|
|
1247
|
+
}
|
|
1182
1248
|
/**
|
|
1183
1249
|
* Returns an async iterator that watches for changes on `filename`, where `filename`is either a file or a directory.
|
|
1184
1250
|
*
|
|
@@ -1211,33 +1277,16 @@ declare module "fs/promises" {
|
|
|
1211
1277
|
*/
|
|
1212
1278
|
function watch(
|
|
1213
1279
|
filename: PathLike,
|
|
1214
|
-
options
|
|
1215
|
-
|
|
1216
|
-
encoding: "buffer";
|
|
1217
|
-
})
|
|
1218
|
-
| "buffer",
|
|
1219
|
-
): AsyncIterable<FileChangeInfo<Buffer>>;
|
|
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
|
-
*/
|
|
1280
|
+
options?: WatchOptionsWithStringEncoding | BufferEncoding,
|
|
1281
|
+
): NodeJS.AsyncIterator<FileChangeInfo<string>>;
|
|
1237
1282
|
function watch(
|
|
1238
1283
|
filename: PathLike,
|
|
1239
|
-
options:
|
|
1240
|
-
):
|
|
1284
|
+
options: WatchOptionsWithBufferEncoding | "buffer",
|
|
1285
|
+
): NodeJS.AsyncIterator<FileChangeInfo<NonSharedBuffer>>;
|
|
1286
|
+
function watch(
|
|
1287
|
+
filename: PathLike,
|
|
1288
|
+
options: WatchOptions | BufferEncoding | "buffer",
|
|
1289
|
+
): NodeJS.AsyncIterator<FileChangeInfo<string | NonSharedBuffer>>;
|
|
1241
1290
|
/**
|
|
1242
1291
|
* Asynchronously copies the entire directory structure from `src` to `dest`,
|
|
1243
1292
|
* including subdirectories and files.
|
|
@@ -1252,20 +1301,28 @@ declare module "fs/promises" {
|
|
|
1252
1301
|
*/
|
|
1253
1302
|
function cp(source: string | URL, destination: string | URL, opts?: CopyOptions): Promise<void>;
|
|
1254
1303
|
/**
|
|
1255
|
-
*
|
|
1304
|
+
* ```js
|
|
1305
|
+
* import { glob } from 'node:fs/promises';
|
|
1306
|
+
*
|
|
1307
|
+
* for await (const entry of glob('*.js'))
|
|
1308
|
+
* console.log(entry);
|
|
1309
|
+
* ```
|
|
1310
|
+
* @since v22.0.0
|
|
1311
|
+
* @returns An AsyncIterator that yields the paths of files
|
|
1312
|
+
* that match the pattern.
|
|
1256
1313
|
*/
|
|
1257
|
-
function glob(pattern: string | string[]): NodeJS.AsyncIterator<string>;
|
|
1314
|
+
function glob(pattern: string | readonly string[]): NodeJS.AsyncIterator<string>;
|
|
1258
1315
|
function glob(
|
|
1259
|
-
pattern: string | string[],
|
|
1260
|
-
|
|
1316
|
+
pattern: string | readonly string[],
|
|
1317
|
+
options: GlobOptionsWithFileTypes,
|
|
1261
1318
|
): NodeJS.AsyncIterator<Dirent>;
|
|
1262
1319
|
function glob(
|
|
1263
|
-
pattern: string | string[],
|
|
1264
|
-
|
|
1320
|
+
pattern: string | readonly string[],
|
|
1321
|
+
options: GlobOptionsWithoutFileTypes,
|
|
1265
1322
|
): NodeJS.AsyncIterator<string>;
|
|
1266
1323
|
function glob(
|
|
1267
|
-
pattern: string | string[],
|
|
1268
|
-
|
|
1324
|
+
pattern: string | readonly string[],
|
|
1325
|
+
options: GlobOptions,
|
|
1269
1326
|
): NodeJS.AsyncIterator<Dirent | string>;
|
|
1270
1327
|
}
|
|
1271
1328
|
declare module "node:fs/promises" {
|