@types/node 24.13.6 → 24.19.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.
Files changed (75) hide show
  1. {node v24.13 → node v24.19}/README.md +1 -1
  2. {node v24.13 → node v24.19}/async_hooks.d.ts +18 -22
  3. {node v24.13 → node v24.19}/buffer.buffer.d.ts +10 -5
  4. {node v24.13 → node v24.19}/buffer.d.ts +7 -0
  5. {node v24.13 → node v24.19}/child_process.d.ts +5 -1
  6. {node v24.13 → node v24.19}/crypto.d.ts +114 -47
  7. {node v24.13 → node v24.19}/dgram.d.ts +119 -4
  8. {node v24.13 → node v24.19}/dns/promises.d.ts +5 -5
  9. {node v24.13 → node v24.19}/dns.d.ts +6 -6
  10. {node v24.13 → node v24.19}/events.d.ts +13 -22
  11. {node v24.13 → node v24.19}/fs/promises.d.ts +79 -66
  12. {node v24.13 → node v24.19}/fs.d.ts +153 -90
  13. {node v24.13 → node v24.19}/http.d.ts +94 -2
  14. {node v24.13 → node v24.19}/http2.d.ts +65 -18
  15. {node v24.13 → node v24.19}/inspector.d.ts +47 -1
  16. {node v24.13 → node v24.19}/inspector.generated.d.ts +167 -0
  17. {node v24.13 → node v24.19}/module.d.ts +1 -0
  18. {node v24.13 → node v24.19}/net.d.ts +139 -15
  19. {node v24.13 → node v24.19}/os.d.ts +30 -30
  20. {node v24.13 → node v24.19}/package.json +3 -3
  21. {node v24.13 → node v24.19}/perf_hooks.d.ts +31 -19
  22. {node v24.13 → node v24.19}/process.d.ts +42 -43
  23. {node v24.13 → node v24.19}/sqlite.d.ts +153 -11
  24. {node v24.13 → node v24.19}/stream/consumers.d.ts +7 -0
  25. {node v24.13 → node v24.19}/stream/web.d.ts +19 -0
  26. {node v24.13 → node v24.19}/stream.d.ts +2 -1
  27. {node v24.13 → node v24.19}/test.d.ts +320 -13
  28. {node v24.13 → node v24.19}/tls.d.ts +50 -15
  29. {node v24.13 → node v24.19}/ts5.6/buffer.buffer.d.ts +5 -0
  30. {node v24.13 → node v24.19}/tty.d.ts +4 -3
  31. {node v24.13 → node v24.19}/url.d.ts +27 -3
  32. {node v24.13 → node v24.19}/util.d.ts +42 -2
  33. {node v24.13 → node v24.19}/v8.d.ts +51 -23
  34. {node v24.13 → node v24.19}/vm.d.ts +52 -87
  35. {node v24.13 → node v24.19}/zlib.d.ts +23 -0
  36. {node v24.13 → node v24.19}/LICENSE +0 -0
  37. {node v24.13 → node v24.19}/assert/strict.d.ts +0 -0
  38. {node v24.13 → node v24.19}/assert.d.ts +0 -0
  39. {node v24.13 → node v24.19}/cluster.d.ts +0 -0
  40. {node v24.13 → node v24.19}/compatibility/iterators.d.ts +0 -0
  41. {node v24.13 → node v24.19}/console.d.ts +0 -0
  42. {node v24.13 → node v24.19}/constants.d.ts +0 -0
  43. {node v24.13 → node v24.19}/diagnostics_channel.d.ts +0 -0
  44. {node v24.13 → node v24.19}/domain.d.ts +0 -0
  45. {node v24.13 → node v24.19}/globals.d.ts +0 -0
  46. {node v24.13 → node v24.19}/globals.typedarray.d.ts +0 -0
  47. {node v24.13 → node v24.19}/https.d.ts +0 -0
  48. {node v24.13 → node v24.19}/index.d.ts +0 -0
  49. {node v24.13 → node v24.19}/path.d.ts +0 -0
  50. {node v24.13 → node v24.19}/punycode.d.ts +0 -0
  51. {node v24.13 → node v24.19}/querystring.d.ts +0 -0
  52. {node v24.13 → node v24.19}/readline/promises.d.ts +0 -0
  53. {node v24.13 → node v24.19}/readline.d.ts +0 -0
  54. {node v24.13 → node v24.19}/repl.d.ts +0 -0
  55. {node v24.13 → node v24.19}/sea.d.ts +0 -0
  56. {node v24.13 → node v24.19}/stream/promises.d.ts +0 -0
  57. {node v24.13 → node v24.19}/string_decoder.d.ts +0 -0
  58. {node v24.13 → node v24.19}/timers/promises.d.ts +0 -0
  59. {node v24.13 → node v24.19}/timers.d.ts +0 -0
  60. {node v24.13 → node v24.19}/trace_events.d.ts +0 -0
  61. {node v24.13 → node v24.19}/ts5.6/compatibility/float16array.d.ts +0 -0
  62. {node v24.13 → node v24.19}/ts5.6/globals.typedarray.d.ts +0 -0
  63. {node v24.13 → node v24.19}/ts5.6/index.d.ts +0 -0
  64. {node v24.13 → node v24.19}/ts5.7/compatibility/float16array.d.ts +0 -0
  65. {node v24.13 → node v24.19}/ts5.7/index.d.ts +0 -0
  66. {node v24.13 → node v24.19}/wasi.d.ts +0 -0
  67. {node v24.13 → node v24.19}/web-globals/abortcontroller.d.ts +0 -0
  68. {node v24.13 → node v24.19}/web-globals/crypto.d.ts +0 -0
  69. {node v24.13 → node v24.19}/web-globals/domexception.d.ts +0 -0
  70. {node v24.13 → node v24.19}/web-globals/events.d.ts +0 -0
  71. {node v24.13 → node v24.19}/web-globals/fetch.d.ts +0 -0
  72. {node v24.13 → node v24.19}/web-globals/navigator.d.ts +0 -0
  73. {node v24.13 → node v24.19}/web-globals/storage.d.ts +0 -0
  74. {node v24.13 → node v24.19}/web-globals/streams.d.ts +0 -0
  75. {node v24.13 → node v24.19}/worker_threads.d.ts +0 -0
@@ -189,7 +189,7 @@ declare module "dns/promises" {
189
189
  * refresh: 900,
190
190
  * retry: 900,
191
191
  * expire: 1800,
192
- * minttl: 60 } ]
192
+ * minttl: 60 } ];
193
193
  * ```
194
194
  * @since v10.6.0
195
195
  */
@@ -232,7 +232,7 @@ declare module "dns/promises" {
232
232
  * regexp: '',
233
233
  * replacement: '_sip._udp.example.com',
234
234
  * order: 30,
235
- * preference: 100
235
+ * preference: 100,
236
236
  * }
237
237
  * ```
238
238
  * @since v10.6.0
@@ -271,7 +271,7 @@ declare module "dns/promises" {
271
271
  * refresh: 10000,
272
272
  * retry: 2400,
273
273
  * expire: 604800,
274
- * minttl: 3600
274
+ * minttl: 3600,
275
275
  * }
276
276
  * ```
277
277
  * @since v10.6.0
@@ -291,7 +291,7 @@ declare module "dns/promises" {
291
291
  * priority: 10,
292
292
  * weight: 5,
293
293
  * port: 21223,
294
- * name: 'service.example.com'
294
+ * name: 'service.example.com',
295
295
  * }
296
296
  * ```
297
297
  * @since v10.6.0
@@ -312,7 +312,7 @@ declare module "dns/promises" {
312
312
  * certUsage: 3,
313
313
  * selector: 1,
314
314
  * match: 1,
315
- * data: [ArrayBuffer]
315
+ * data: [ArrayBuffer],
316
316
  * }
317
317
  * ```
318
318
  * @since v23.9.0, v22.15.0
@@ -81,7 +81,7 @@ declare module "dns" {
81
81
  */
82
82
  all?: boolean | undefined;
83
83
  /**
84
- * When `verbatim`, the resolved addresses are return unsorted. When `ipv4first`, the resolved addresses are sorted
84
+ * When `verbatim`, the resolved addresses are returned unsorted. When `ipv4first`, the resolved addresses are sorted
85
85
  * by placing IPv4 addresses before IPv6 addresses. When `ipv6first`, the resolved addresses are sorted by placing IPv6
86
86
  * addresses before IPv4 addresses. Default value is configurable using
87
87
  * {@link setDefaultResultOrder} or [`--dns-result-order`](https://nodejs.org/docs/latest-v24.x/api/cli.html#--dns-result-orderorder).
@@ -539,7 +539,7 @@ declare module "dns" {
539
539
  * regexp: '',
540
540
  * replacement: '_sip._udp.example.com',
541
541
  * order: 30,
542
- * preference: 100
542
+ * preference: 100,
543
543
  * }
544
544
  * ```
545
545
  * @since v0.9.12
@@ -596,7 +596,7 @@ declare module "dns" {
596
596
  * refresh: 10000,
597
597
  * retry: 2400,
598
598
  * expire: 604800,
599
- * minttl: 3600
599
+ * minttl: 3600,
600
600
  * }
601
601
  * ```
602
602
  * @since v0.11.10
@@ -622,7 +622,7 @@ declare module "dns" {
622
622
  * priority: 10,
623
623
  * weight: 5,
624
624
  * port: 21223,
625
- * name: 'service.example.com'
625
+ * name: 'service.example.com',
626
626
  * }
627
627
  * ```
628
628
  * @since v0.1.27
@@ -649,7 +649,7 @@ declare module "dns" {
649
649
  * certUsage: 3,
650
650
  * selector: 1,
651
651
  * match: 1,
652
- * data: [ArrayBuffer]
652
+ * data: [ArrayBuffer],
653
653
  * }
654
654
  * ```
655
655
  * @since v23.9.0, v22.15.0
@@ -699,7 +699,7 @@ declare module "dns" {
699
699
  * refresh: 900,
700
700
  * retry: 900,
701
701
  * expire: 1800,
702
- * minttl: 60 } ]
702
+ * minttl: 60 } ];
703
703
  * ```
704
704
  *
705
705
  * DNS server operators may choose not to respond to `ANY` queries. It may be better to call individual methods like {@link resolve4}, {@link resolveMx}, and so on. For more details, see
@@ -278,23 +278,17 @@ declare module "events" {
278
278
  options?: StaticEventEmitterIteratorOptions,
279
279
  ): NodeJS.AsyncIterator<any[]>;
280
280
  /**
281
- * A class method that returns the number of listeners for the given `eventName` registered on the given `emitter`.
281
+ * Returns the number of registered listeners for the event named `eventName`.
282
282
  *
283
- * ```js
284
- * import { EventEmitter, listenerCount } from 'node:events';
283
+ * For `EventEmitter`s this behaves exactly the same as calling `.listenerCount`
284
+ * on the emitter.
285
285
  *
286
- * const myEmitter = new EventEmitter();
287
- * myEmitter.on('event', () => {});
288
- * myEmitter.on('event', () => {});
289
- * console.log(listenerCount(myEmitter, 'event'));
290
- * // Prints: 2
291
- * ```
286
+ * For `EventTarget`s this is the only way to obtain the listener count. This can
287
+ * be useful for debugging and diagnostic purposes.
292
288
  * @since v0.9.12
293
- * @deprecated Since v3.2.0 - Use `listenerCount` instead.
294
- * @param emitter The emitter to query
295
- * @param eventName The event name
296
289
  */
297
- static listenerCount(emitter: NodeJS.EventEmitter, eventName: string | symbol): number;
290
+ static listenerCount(emitter: EventEmitter, eventName: string | symbol): number;
291
+ static listenerCount(emitter: EventTarget, eventName: string): number;
298
292
  /**
299
293
  * Returns a copy of the array of listeners for the event named `eventName`.
300
294
  *
@@ -386,15 +380,12 @@ declare module "events" {
386
380
  * import { addAbortListener } from 'node:events';
387
381
  *
388
382
  * function example(signal) {
389
- * let disposable;
390
- * try {
391
- * signal.addEventListener('abort', (e) => e.stopImmediatePropagation());
392
- * disposable = addAbortListener(signal, (e) => {
393
- * // Do something when signal is aborted.
394
- * });
395
- * } finally {
396
- * disposable?.[Symbol.dispose]();
397
- * }
383
+ * signal.addEventListener('abort', (e) => e.stopImmediatePropagation());
384
+ * // addAbortListener() returns a disposable, so the `using` keyword ensures
385
+ * // the abort listener is automatically removed when this scope exits.
386
+ * using _ = addAbortListener(signal, (e) => {
387
+ * // Do something when signal is aborted.
388
+ * });
398
389
  * }
399
390
  * ```
400
391
  * @since v20.5.0
@@ -9,9 +9,8 @@
9
9
  * @since v10.0.0
10
10
  */
11
11
  declare module "fs/promises" {
12
- import { NonSharedBuffer } from "node:buffer";
12
+ import { BufferView, NonSharedBuffer } from "node:buffer";
13
13
  import { Abortable } from "node:events";
14
- import { Stream } from "node:stream";
15
14
  import { ReadableStream } from "node:stream/web";
16
15
  import {
17
16
  BigIntStats,
@@ -31,6 +30,10 @@ declare module "fs/promises" {
31
30
  OpenDirOptions,
32
31
  OpenMode,
33
32
  PathLike,
33
+ ReadFileOptions,
34
+ ReadFileOptionsWithBuffer,
35
+ ReadFileOptionsWithBufferEncoding,
36
+ ReadFileOptionsWithStringEncoding,
34
37
  ReadOptions,
35
38
  ReadOptionsWithBuffer,
36
39
  ReadPosition,
@@ -281,39 +284,61 @@ declare module "fs/promises" {
281
284
  *
282
285
  * If `options` is a string, then it specifies the `encoding`.
283
286
  *
287
+ * If `buffer` is provided and no encoding is specified, the returned {Buffer} is
288
+ * a view over the supplied buffer containing only the bytes read. If the
289
+ * supplied buffer is too small to contain the entire file, the operation will
290
+ * fail.
291
+ *
284
292
  * The `FileHandle` has to support reading.
285
293
  *
286
- * If one or more `filehandle.read()` calls are made on a file handle and then a `filehandle.readFile()` call is made, the data will be read from the current
294
+ * If one or more `filehandle.read()` calls are made on a file handle and then a
295
+ * `filehandle.readFile()` call is made, the data will be read from the current
287
296
  * position till the end of the file. It doesn't always read from the beginning
288
297
  * of the file.
298
+ *
299
+ * An example using the `buffer` option with a pre-allocated buffer:
300
+ *
301
+ * ```js
302
+ * import { Buffer } from 'node:buffer';
303
+ * import { open } from 'node:fs/promises';
304
+ *
305
+ * const file = await open('./some/file/to/read');
306
+ * try {
307
+ * const buf = Buffer.alloc(16384);
308
+ * const contents = await file.readFile({ buffer: buf });
309
+ * console.log(contents); // A view over `buf` containing only the bytes read
310
+ * } finally {
311
+ * await file.close();
312
+ * }
313
+ * ```
314
+ *
315
+ * An example using the `buffer` option with a function returning a buffer:
316
+ *
317
+ * ```js
318
+ * import { Buffer } from 'node:buffer';
319
+ * import { open } from 'node:fs/promises';
320
+ *
321
+ * const file = await open('./some/file/to/read');
322
+ * try {
323
+ * const contents = await file.readFile({
324
+ * buffer: (size) => Buffer.alloc(size),
325
+ * });
326
+ * console.log(contents);
327
+ * } finally {
328
+ * await file.close();
329
+ * }
330
+ * ```
289
331
  * @since v10.0.0
290
- * @return Fulfills upon a successful read with the contents of the file. If no encoding is specified (using `options.encoding`), the data is returned as a {Buffer} object. Otherwise, the
291
- * data will be a string.
332
+ * @returns Fulfills upon a successful read with the contents of the
333
+ * file. If no encoding is specified (using `options.encoding`), the data is
334
+ * returned as a `Buffer` object. Otherwise, the data will be a string.
292
335
  */
293
- readFile(
294
- options?:
295
- | ({ encoding?: null | undefined } & Abortable)
296
- | null,
297
- ): Promise<NonSharedBuffer>;
298
- /**
299
- * Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically.
300
- * The `FileHandle` must have been opened for reading.
301
- */
302
- readFile(
303
- options:
304
- | ({ encoding: BufferEncoding } & Abortable)
305
- | BufferEncoding,
306
- ): Promise<string>;
307
- /**
308
- * Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically.
309
- * The `FileHandle` must have been opened for reading.
310
- */
311
- readFile(
312
- options?:
313
- | (ObjectEncodingOptions & Abortable)
314
- | BufferEncoding
315
- | null,
316
- ): Promise<string | NonSharedBuffer>;
336
+ readFile<T extends NodeJS.ArrayBufferView>(
337
+ options: Omit<ReadFileOptionsWithBuffer<T>, "flag">,
338
+ ): Promise<BufferView<T>>;
339
+ readFile(options?: Omit<ReadFileOptionsWithBufferEncoding, "flag"> | null): Promise<NonSharedBuffer>;
340
+ readFile(options: Omit<ReadFileOptionsWithStringEncoding, "flag"> | BufferEncoding): Promise<string>;
341
+ readFile(options: Omit<ReadFileOptions, "flag"> | BufferEncoding | null): Promise<string | NonSharedBuffer>;
317
342
  /**
318
343
  * Convenience method to create a `readline` interface and stream over the file.
319
344
  * See `filehandle.createReadStream()` for the options.
@@ -337,14 +362,28 @@ declare module "fs/promises" {
337
362
  stat(
338
363
  opts?: StatOptions & {
339
364
  bigint?: false | undefined;
365
+ throwIfNoEntry?: true | undefined;
340
366
  },
341
367
  ): Promise<Stats>;
342
368
  stat(
343
369
  opts: StatOptions & {
344
370
  bigint: true;
371
+ throwIfNoEntry?: true | undefined;
345
372
  },
346
373
  ): Promise<BigIntStats>;
347
- stat(opts?: StatOptions): Promise<Stats | BigIntStats>;
374
+ stat(
375
+ opts?: StatOptions & {
376
+ bigint?: false | undefined;
377
+ throwIfNoEntry: false;
378
+ },
379
+ ): Promise<Stats | undefined>;
380
+ stat(
381
+ opts: StatOptions & {
382
+ bigint: true;
383
+ throwIfNoEntry: false;
384
+ },
385
+ ): Promise<BigIntStats | undefined>;
386
+ stat(opts?: StatOptions): Promise<Stats | BigIntStats | undefined>;
348
387
  /**
349
388
  * Truncates the file.
350
389
  *
@@ -1172,50 +1211,21 @@ declare module "fs/promises" {
1172
1211
  * @param path filename or `FileHandle`
1173
1212
  * @return Fulfills with the contents of the file.
1174
1213
  */
1214
+ function readFile<T extends NodeJS.ArrayBufferView>(
1215
+ path: PathLike | FileHandle,
1216
+ options: ReadFileOptionsWithBuffer<T>,
1217
+ ): Promise<BufferView<T>>;
1175
1218
  function readFile(
1176
1219
  path: PathLike | FileHandle,
1177
- options?:
1178
- | ({
1179
- encoding?: null | undefined;
1180
- flag?: OpenMode | undefined;
1181
- } & Abortable)
1182
- | null,
1220
+ options?: ReadFileOptionsWithBufferEncoding | null,
1183
1221
  ): Promise<NonSharedBuffer>;
1184
- /**
1185
- * Asynchronously reads the entire contents of a file.
1186
- * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1187
- * If a `FileHandle` is provided, the underlying file will _not_ be closed automatically.
1188
- * @param options An object that may contain an optional flag.
1189
- * If a flag is not provided, it defaults to `'r'`.
1190
- */
1191
1222
  function readFile(
1192
1223
  path: PathLike | FileHandle,
1193
- options:
1194
- | ({
1195
- encoding: BufferEncoding;
1196
- flag?: OpenMode | undefined;
1197
- } & Abortable)
1198
- | BufferEncoding,
1224
+ options: ReadFileOptionsWithStringEncoding | BufferEncoding,
1199
1225
  ): Promise<string>;
1200
- /**
1201
- * Asynchronously reads the entire contents of a file.
1202
- * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1203
- * If a `FileHandle` is provided, the underlying file will _not_ be closed automatically.
1204
- * @param options An object that may contain an optional flag.
1205
- * If a flag is not provided, it defaults to `'r'`.
1206
- */
1207
1226
  function readFile(
1208
1227
  path: PathLike | FileHandle,
1209
- options?:
1210
- | (
1211
- & ObjectEncodingOptions
1212
- & Abortable
1213
- & {
1214
- flag?: OpenMode | undefined;
1215
- }
1216
- )
1217
- | BufferEncoding
1218
- | null,
1228
+ options: ReadFileOptions | BufferEncoding | null,
1219
1229
  ): Promise<string | NonSharedBuffer>;
1220
1230
  /**
1221
1231
  * 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.
@@ -1312,6 +1322,9 @@ declare module "fs/promises" {
1312
1322
  */
1313
1323
  function cp(source: string | URL, destination: string | URL, opts?: CopyOptions): Promise<void>;
1314
1324
  /**
1325
+ * When `followSymlinks` is enabled, detected symbolic link cycles are not
1326
+ * traversed recursively.
1327
+ *
1315
1328
  * ```js
1316
1329
  * import { glob } from 'node:fs/promises';
1317
1330
  *