@types/node 22.15.33 → 22.19.2

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.
Files changed (79) hide show
  1. node v22.19/README.md +15 -0
  2. node v22.19/assert/strict.d.ts +111 -0
  3. {node v22.15 → node v22.19}/assert.d.ts +119 -95
  4. {node v22.15 → node v22.19}/buffer.buffer.d.ts +9 -0
  5. {node v22.15 → node v22.19}/buffer.d.ts +14 -6
  6. {node v22.15 → node v22.19}/child_process.d.ts +89 -162
  7. {node v22.15 → node v22.19}/cluster.d.ts +4 -5
  8. {node v22.15 → node v22.19}/crypto.d.ts +203 -167
  9. {node v22.15 → node v22.19}/dgram.d.ts +9 -8
  10. {node v22.15 → node v22.19}/dns/promises.d.ts +11 -10
  11. {node v22.15 → node v22.19}/dns.d.ts +24 -20
  12. {node v22.15 → node v22.19}/events.d.ts +80 -35
  13. {node v22.15 → node v22.19}/fs/promises.d.ts +78 -56
  14. {node v22.15 → node v22.19}/fs.d.ts +153 -129
  15. node v22.19/globals.d.ts +172 -0
  16. node v22.19/globals.typedarray.d.ts +38 -0
  17. {node v22.15 → node v22.19}/http.d.ts +140 -35
  18. {node v22.15 → node v22.19}/http2.d.ts +45 -26
  19. {node v22.15 → node v22.19}/https.d.ts +96 -62
  20. {node v22.15 → node v22.19}/index.d.ts +7 -2
  21. node v22.19/inspector.d.ts +253 -0
  22. node v22.15/inspector.d.ts → node v22.19/inspector.generated.d.ts +880 -830
  23. {node v22.15 → node v22.19}/module.d.ts +70 -13
  24. {node v22.15 → node v22.19}/net.d.ts +33 -11
  25. {node v22.15 → node v22.19}/os.d.ts +14 -3
  26. {node v22.15 → node v22.19}/package.json +3 -83
  27. {node v22.15 → node v22.19}/path.d.ts +1 -1
  28. {node v22.15 → node v22.19}/perf_hooks.d.ts +6 -8
  29. {node v22.15 → node v22.19}/process.d.ts +34 -27
  30. {node v22.15 → node v22.19}/readline/promises.d.ts +1 -2
  31. {node v22.15 → node v22.19}/repl.d.ts +3 -5
  32. {node v22.15 → node v22.19}/sqlite.d.ts +219 -6
  33. {node v22.15 → node v22.19}/stream/consumers.d.ts +2 -2
  34. {node v22.15 → node v22.19}/stream/web.d.ts +8 -0
  35. {node v22.15 → node v22.19}/stream.d.ts +29 -33
  36. {node v22.15 → node v22.19}/string_decoder.d.ts +2 -2
  37. node v22.19/test.d.ts +2162 -0
  38. {node v22.15 → node v22.19}/tls.d.ts +122 -66
  39. {node v22.15 → node v22.19}/ts5.6/buffer.buffer.d.ts +10 -2
  40. node v22.19/ts5.6/globals.typedarray.d.ts +34 -0
  41. {node v22.15 → node v22.19}/ts5.6/index.d.ts +7 -2
  42. {node v22.15 → node v22.19}/url.d.ts +21 -9
  43. {node v22.15 → node v22.19}/util.d.ts +32 -10
  44. {node v22.15 → node v22.19}/v8.d.ts +33 -35
  45. {node v22.15 → node v22.19}/vm.d.ts +21 -50
  46. {node v22.15 → node v22.19}/wasi.d.ts +1 -1
  47. node v22.19/web-globals/abortcontroller.d.ts +34 -0
  48. node v22.19/web-globals/domexception.d.ts +68 -0
  49. node v22.15/dom-events.d.ts → node v22.19/web-globals/events.d.ts +49 -51
  50. node v22.19/web-globals/fetch.d.ts +46 -0
  51. node v22.19/web-globals/navigator.d.ts +22 -0
  52. node v22.19/web-globals/storage.d.ts +24 -0
  53. {node v22.15 → node v22.19}/worker_threads.d.ts +93 -67
  54. {node v22.15 → node v22.19}/zlib.d.ts +39 -26
  55. node v22.15/README.md +0 -15
  56. node v22.15/assert/strict.d.ts +0 -8
  57. node v22.15/globals.d.ts +0 -364
  58. node v22.15/globals.typedarray.d.ts +0 -21
  59. node v22.15/test.d.ts +0 -2278
  60. node v22.15/ts5.6/globals.typedarray.d.ts +0 -19
  61. {node v22.15 → node v22.19}/LICENSE +0 -0
  62. {node v22.15 → node v22.19}/async_hooks.d.ts +1 -1
  63. {node v22.15 → node v22.19}/compatibility/disposable.d.ts +0 -0
  64. {node v22.15 → node v22.19}/compatibility/index.d.ts +0 -0
  65. {node v22.15 → node v22.19}/compatibility/indexable.d.ts +0 -0
  66. {node v22.15 → node v22.19}/compatibility/iterators.d.ts +0 -0
  67. {node v22.15 → node v22.19}/console.d.ts +0 -0
  68. {node v22.15 → node v22.19}/constants.d.ts +0 -0
  69. {node v22.15 → node v22.19}/diagnostics_channel.d.ts +0 -0
  70. {node v22.15 → node v22.19}/domain.d.ts +0 -0
  71. {node v22.15 → node v22.19}/punycode.d.ts +0 -0
  72. {node v22.15 → node v22.19}/querystring.d.ts +0 -0
  73. {node v22.15 → node v22.19}/readline.d.ts +0 -0
  74. {node v22.15 → node v22.19}/sea.d.ts +0 -0
  75. {node v22.15 → node v22.19}/stream/promises.d.ts +0 -0
  76. {node v22.15 → node v22.19}/timers/promises.d.ts +0 -0
  77. {node v22.15 → node v22.19}/timers.d.ts +0 -0
  78. {node v22.15 → node v22.19}/trace_events.d.ts +0 -0
  79. {node v22.15 → node v22.19}/tty.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";
@@ -29,6 +30,8 @@ declare module "fs/promises" {
29
30
  OpenDirOptions,
30
31
  OpenMode,
31
32
  PathLike,
33
+ ReadOptions,
34
+ ReadOptionsWithBuffer,
32
35
  ReadPosition,
33
36
  ReadStream,
34
37
  ReadVResult,
@@ -40,7 +43,7 @@ declare module "fs/promises" {
40
43
  StatsFs,
41
44
  TimeLike,
42
45
  WatchEventType,
43
- WatchOptions,
46
+ WatchOptions as _WatchOptions,
44
47
  WriteStream,
45
48
  WriteVResult,
46
49
  } from "node:fs";
@@ -57,6 +60,7 @@ declare module "fs/promises" {
57
60
  bytesRead: number;
58
61
  buffer: T;
59
62
  }
63
+ /** @deprecated This interface will be removed in a future version. Use `import { ReadOptionsWithBuffer } from "node:fs"` instead. */
60
64
  interface FileReadOptions<T extends NodeJS.ArrayBufferView = Buffer> {
61
65
  /**
62
66
  * @default `Buffer.alloc(0xffff)`
@@ -88,6 +92,9 @@ declare module "fs/promises" {
88
92
  highWaterMark?: number | undefined;
89
93
  flush?: boolean | undefined;
90
94
  }
95
+ interface ReadableWebStreamOptions {
96
+ autoClose?: boolean | undefined;
97
+ }
91
98
  // TODO: Add `EventEmitter` close
92
99
  interface FileHandle {
93
100
  /**
@@ -232,11 +239,13 @@ declare module "fs/promises" {
232
239
  length?: number | null,
233
240
  position?: ReadPosition | null,
234
241
  ): Promise<FileReadResult<T>>;
235
- read<T extends NodeJS.ArrayBufferView = Buffer>(
242
+ read<T extends NodeJS.ArrayBufferView>(
236
243
  buffer: T,
237
- options?: FileReadOptions<T>,
244
+ options?: ReadOptions,
245
+ ): Promise<FileReadResult<T>>;
246
+ read<T extends NodeJS.ArrayBufferView = NonSharedBuffer>(
247
+ options?: ReadOptionsWithBuffer<T>,
238
248
  ): Promise<FileReadResult<T>>;
239
- read<T extends NodeJS.ArrayBufferView = Buffer>(options?: FileReadOptions<T>): Promise<FileReadResult<T>>;
240
249
  /**
241
250
  * Returns a byte-oriented `ReadableStream` that may be used to read the file's
242
251
  * contents.
@@ -260,9 +269,8 @@ declare module "fs/promises" {
260
269
  * While the `ReadableStream` will read the file to completion, it will not
261
270
  * close the `FileHandle` automatically. User code must still call the`fileHandle.close()` method.
262
271
  * @since v17.0.0
263
- * @experimental
264
272
  */
265
- readableWebStream(): ReadableStream;
273
+ readableWebStream(options?: ReadableWebStreamOptions): ReadableStream;
266
274
  /**
267
275
  * Asynchronously reads the entire contents of a file.
268
276
  *
@@ -281,7 +289,7 @@ declare module "fs/promises" {
281
289
  options?:
282
290
  | ({ encoding?: null | undefined } & Abortable)
283
291
  | null,
284
- ): Promise<Buffer>;
292
+ ): Promise<NonSharedBuffer>;
285
293
  /**
286
294
  * Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically.
287
295
  * The `FileHandle` must have been opened for reading.
@@ -300,7 +308,7 @@ declare module "fs/promises" {
300
308
  | (ObjectEncodingOptions & Abortable)
301
309
  | BufferEncoding
302
310
  | null,
303
- ): Promise<string | Buffer>;
311
+ ): Promise<string | NonSharedBuffer>;
304
312
  /**
305
313
  * Convenience method to create a `readline` interface and stream over the file.
306
314
  * See `filehandle.createReadStream()` for the options.
@@ -409,7 +417,7 @@ declare module "fs/promises" {
409
417
  * @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
418
  * position. See the POSIX pwrite(2) documentation for more detail.
411
419
  */
412
- write<TBuffer extends Uint8Array>(
420
+ write<TBuffer extends NodeJS.ArrayBufferView>(
413
421
  buffer: TBuffer,
414
422
  offset?: number | null,
415
423
  length?: number | null,
@@ -448,14 +456,20 @@ declare module "fs/promises" {
448
456
  * @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
457
  * position.
450
458
  */
451
- writev(buffers: readonly NodeJS.ArrayBufferView[], position?: number): Promise<WriteVResult>;
459
+ writev<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
460
+ buffers: TBuffers,
461
+ position?: number,
462
+ ): Promise<WriteVResult<TBuffers>>;
452
463
  /**
453
464
  * Read from a file and write to an array of [ArrayBufferView](https://developer.mozilla.org/en-US/docs/Web/API/ArrayBufferView) s
454
465
  * @since v13.13.0, v12.17.0
455
466
  * @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
467
  * @return Fulfills upon success an object containing two properties:
457
468
  */
458
- readv(buffers: readonly NodeJS.ArrayBufferView[], position?: number): Promise<ReadVResult>;
469
+ readv<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
470
+ buffers: TBuffers,
471
+ position?: number,
472
+ ): Promise<ReadVResult<TBuffers>>;
459
473
  /**
460
474
  * Closes the file handle after waiting for any pending operation on the handle to
461
475
  * complete.
@@ -475,7 +489,8 @@ declare module "fs/promises" {
475
489
  */
476
490
  close(): Promise<void>;
477
491
  /**
478
- * An alias for {@link FileHandle.close()}.
492
+ * Calls `filehandle.close()` and returns a promise that fulfills when the
493
+ * filehandle is closed.
479
494
  * @since v20.4.0
480
495
  */
481
496
  [Symbol.asyncDispose](): Promise<void>;
@@ -691,7 +706,7 @@ declare module "fs/promises" {
691
706
  recursive?: boolean | undefined;
692
707
  }
693
708
  | "buffer",
694
- ): Promise<Buffer[]>;
709
+ ): Promise<NonSharedBuffer[]>;
695
710
  /**
696
711
  * Asynchronous readdir(3) - read a directory.
697
712
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -706,7 +721,7 @@ declare module "fs/promises" {
706
721
  })
707
722
  | BufferEncoding
708
723
  | null,
709
- ): Promise<string[] | Buffer[]>;
724
+ ): Promise<string[] | NonSharedBuffer[]>;
710
725
  /**
711
726
  * Asynchronous readdir(3) - read a directory.
712
727
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -731,7 +746,7 @@ declare module "fs/promises" {
731
746
  withFileTypes: true;
732
747
  recursive?: boolean | undefined;
733
748
  },
734
- ): Promise<Dirent<Buffer>[]>;
749
+ ): Promise<Dirent<NonSharedBuffer>[]>;
735
750
  /**
736
751
  * 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
752
  * fulfilled with the`linkString` upon success.
@@ -749,13 +764,16 @@ declare module "fs/promises" {
749
764
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
750
765
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
751
766
  */
752
- function readlink(path: PathLike, options: BufferEncodingOption): Promise<Buffer>;
767
+ function readlink(path: PathLike, options: BufferEncodingOption): Promise<NonSharedBuffer>;
753
768
  /**
754
769
  * Asynchronous readlink(2) - read value of a symbolic link.
755
770
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
756
771
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
757
772
  */
758
- function readlink(path: PathLike, options?: ObjectEncodingOptions | string | null): Promise<string | Buffer>;
773
+ function readlink(
774
+ path: PathLike,
775
+ options?: ObjectEncodingOptions | string | null,
776
+ ): Promise<string | NonSharedBuffer>;
759
777
  /**
760
778
  * Creates a symbolic link.
761
779
  *
@@ -906,7 +924,7 @@ declare module "fs/promises" {
906
924
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
907
925
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
908
926
  */
909
- function realpath(path: PathLike, options: BufferEncodingOption): Promise<Buffer>;
927
+ function realpath(path: PathLike, options: BufferEncodingOption): Promise<NonSharedBuffer>;
910
928
  /**
911
929
  * Asynchronous realpath(3) - return the canonicalized absolute pathname.
912
930
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -915,7 +933,7 @@ declare module "fs/promises" {
915
933
  function realpath(
916
934
  path: PathLike,
917
935
  options?: ObjectEncodingOptions | BufferEncoding | null,
918
- ): Promise<string | Buffer>;
936
+ ): Promise<string | NonSharedBuffer>;
919
937
  /**
920
938
  * Creates a unique temporary directory. A unique directory name is generated by
921
939
  * appending six random characters to the end of the provided `prefix`. Due to
@@ -951,13 +969,16 @@ declare module "fs/promises" {
951
969
  * Generates six random characters to be appended behind a required `prefix` to create a unique temporary directory.
952
970
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
953
971
  */
954
- function mkdtemp(prefix: string, options: BufferEncodingOption): Promise<Buffer>;
972
+ function mkdtemp(prefix: string, options: BufferEncodingOption): Promise<NonSharedBuffer>;
955
973
  /**
956
974
  * Asynchronously creates a unique temporary directory.
957
975
  * Generates six random characters to be appended behind a required `prefix` to create a unique temporary directory.
958
976
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
959
977
  */
960
- function mkdtemp(prefix: string, options?: ObjectEncodingOptions | BufferEncoding | null): Promise<string | Buffer>;
978
+ function mkdtemp(
979
+ prefix: string,
980
+ options?: ObjectEncodingOptions | BufferEncoding | null,
981
+ ): Promise<string | NonSharedBuffer>;
961
982
  /**
962
983
  * Asynchronously writes data to a file, replacing the file if it already exists. `data` can be a string, a buffer, an
963
984
  * [AsyncIterable](https://tc39.github.io/ecma262/#sec-asynciterable-interface), or an
@@ -1113,7 +1134,7 @@ declare module "fs/promises" {
1113
1134
  flag?: OpenMode | undefined;
1114
1135
  } & Abortable)
1115
1136
  | null,
1116
- ): Promise<Buffer>;
1137
+ ): Promise<NonSharedBuffer>;
1117
1138
  /**
1118
1139
  * Asynchronously reads the entire contents of a file.
1119
1140
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -1149,7 +1170,7 @@ declare module "fs/promises" {
1149
1170
  )
1150
1171
  | BufferEncoding
1151
1172
  | null,
1152
- ): Promise<string | Buffer>;
1173
+ ): Promise<string | NonSharedBuffer>;
1153
1174
  /**
1154
1175
  * 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
1176
  *
@@ -1179,6 +1200,16 @@ declare module "fs/promises" {
1179
1200
  * @return Fulfills with an {fs.Dir}.
1180
1201
  */
1181
1202
  function opendir(path: PathLike, options?: OpenDirOptions): Promise<Dir>;
1203
+ interface WatchOptions extends _WatchOptions {
1204
+ maxQueue?: number | undefined;
1205
+ overflow?: "ignore" | "throw" | undefined;
1206
+ }
1207
+ interface WatchOptionsWithBufferEncoding extends WatchOptions {
1208
+ encoding: "buffer";
1209
+ }
1210
+ interface WatchOptionsWithStringEncoding extends WatchOptions {
1211
+ encoding?: BufferEncoding | undefined;
1212
+ }
1182
1213
  /**
1183
1214
  * Returns an async iterator that watches for changes on `filename`, where `filename`is either a file or a directory.
1184
1215
  *
@@ -1211,33 +1242,16 @@ declare module "fs/promises" {
1211
1242
  */
1212
1243
  function watch(
1213
1244
  filename: PathLike,
1214
- options:
1215
- | (WatchOptions & {
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
- */
1245
+ options?: WatchOptionsWithStringEncoding | BufferEncoding,
1246
+ ): NodeJS.AsyncIterator<FileChangeInfo<string>>;
1237
1247
  function watch(
1238
1248
  filename: PathLike,
1239
- options: WatchOptions | string,
1240
- ): AsyncIterable<FileChangeInfo<string>> | AsyncIterable<FileChangeInfo<Buffer>>;
1249
+ options: WatchOptionsWithBufferEncoding | "buffer",
1250
+ ): NodeJS.AsyncIterator<FileChangeInfo<NonSharedBuffer>>;
1251
+ function watch(
1252
+ filename: PathLike,
1253
+ options: WatchOptions | BufferEncoding | "buffer",
1254
+ ): NodeJS.AsyncIterator<FileChangeInfo<string | NonSharedBuffer>>;
1241
1255
  /**
1242
1256
  * Asynchronously copies the entire directory structure from `src` to `dest`,
1243
1257
  * including subdirectories and files.
@@ -1252,20 +1266,28 @@ declare module "fs/promises" {
1252
1266
  */
1253
1267
  function cp(source: string | URL, destination: string | URL, opts?: CopyOptions): Promise<void>;
1254
1268
  /**
1255
- * Retrieves the files matching the specified pattern.
1269
+ * ```js
1270
+ * import { glob } from 'node:fs/promises';
1271
+ *
1272
+ * for await (const entry of glob('*.js'))
1273
+ * console.log(entry);
1274
+ * ```
1275
+ * @since v22.0.0
1276
+ * @returns An AsyncIterator that yields the paths of files
1277
+ * that match the pattern.
1256
1278
  */
1257
- function glob(pattern: string | string[]): NodeJS.AsyncIterator<string>;
1279
+ function glob(pattern: string | readonly string[]): NodeJS.AsyncIterator<string>;
1258
1280
  function glob(
1259
- pattern: string | string[],
1260
- opt: GlobOptionsWithFileTypes,
1281
+ pattern: string | readonly string[],
1282
+ options: GlobOptionsWithFileTypes,
1261
1283
  ): NodeJS.AsyncIterator<Dirent>;
1262
1284
  function glob(
1263
- pattern: string | string[],
1264
- opt: GlobOptionsWithoutFileTypes,
1285
+ pattern: string | readonly string[],
1286
+ options: GlobOptionsWithoutFileTypes,
1265
1287
  ): NodeJS.AsyncIterator<string>;
1266
1288
  function glob(
1267
- pattern: string | string[],
1268
- opt: GlobOptions,
1289
+ pattern: string | readonly string[],
1290
+ options: GlobOptions,
1269
1291
  ): NodeJS.AsyncIterator<Dirent | string>;
1270
1292
  }
1271
1293
  declare module "node:fs/promises" {