@types/node 18.16.20 → 18.17.0

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 (111) hide show
  1. {node v18.16 → node v18.17}/README.md +1 -1
  2. {node v18.16/ts4.8 → node v18.17}/dns.d.ts +8 -0
  3. {node v18.16 → node v18.17}/events.d.ts +29 -0
  4. {node v18.16 → node v18.17}/fs/promises.d.ts +12 -1
  5. {node v18.16 → node v18.17}/fs.d.ts +16 -0
  6. {node v18.16 → node v18.17}/http.d.ts +7 -0
  7. {node v18.16 → node v18.17}/index.d.ts +1 -1
  8. {node v18.16 → node v18.17}/package.json +2 -2
  9. {node v18.16 → node v18.17}/stream.d.ts +14 -0
  10. {node v18.16 → node v18.17}/test.d.ts +235 -116
  11. {node v18.16 → node v18.17/ts4.8}/dns.d.ts +8 -0
  12. {node v18.16 → node v18.17}/ts4.8/events.d.ts +29 -0
  13. {node v18.16 → node v18.17}/ts4.8/fs/promises.d.ts +33 -1
  14. {node v18.16 → node v18.17}/ts4.8/fs.d.ts +118 -1
  15. {node v18.16 → node v18.17}/ts4.8/http.d.ts +73 -3
  16. {node v18.16 → node v18.17}/ts4.8/stream.d.ts +17 -3
  17. {node v18.16 → node v18.17}/ts4.8/test.d.ts +235 -117
  18. {node v18.16 → node v18.17}/ts4.8/url.d.ts +14 -0
  19. {node v18.16 → node v18.17}/url.d.ts +14 -0
  20. {node v18.16 → node v18.17}/LICENSE +0 -0
  21. {node v18.16 → node v18.17}/assert/strict.d.ts +0 -0
  22. {node v18.16 → node v18.17}/assert.d.ts +0 -0
  23. {node v18.16 → node v18.17}/async_hooks.d.ts +0 -0
  24. {node v18.16 → node v18.17}/buffer.d.ts +0 -0
  25. {node v18.16 → node v18.17}/child_process.d.ts +0 -0
  26. {node v18.16 → node v18.17}/cluster.d.ts +0 -0
  27. {node v18.16 → node v18.17}/console.d.ts +0 -0
  28. {node v18.16 → node v18.17}/constants.d.ts +0 -0
  29. {node v18.16 → node v18.17}/crypto.d.ts +0 -0
  30. {node v18.16 → node v18.17}/dgram.d.ts +0 -0
  31. {node v18.16 → node v18.17}/diagnostics_channel.d.ts +0 -0
  32. {node v18.16 → node v18.17}/dns/promises.d.ts +0 -0
  33. {node v18.16 → node v18.17}/dom-events.d.ts +0 -0
  34. {node v18.16 → node v18.17}/domain.d.ts +0 -0
  35. {node v18.16 → node v18.17}/globals.d.ts +0 -0
  36. {node v18.16 → node v18.17}/globals.global.d.ts +0 -0
  37. {node v18.16 → node v18.17}/http2.d.ts +0 -0
  38. {node v18.16 → node v18.17}/https.d.ts +0 -0
  39. {node v18.16 → node v18.17}/inspector.d.ts +0 -0
  40. {node v18.16 → node v18.17}/module.d.ts +0 -0
  41. {node v18.16 → node v18.17}/net.d.ts +0 -0
  42. {node v18.16 → node v18.17}/os.d.ts +0 -0
  43. {node v18.16 → node v18.17}/path.d.ts +0 -0
  44. {node v18.16 → node v18.17}/perf_hooks.d.ts +0 -0
  45. {node v18.16 → node v18.17}/process.d.ts +0 -0
  46. {node v18.16 → node v18.17}/punycode.d.ts +0 -0
  47. {node v18.16 → node v18.17}/querystring.d.ts +0 -0
  48. {node v18.16 → node v18.17}/readline/promises.d.ts +0 -0
  49. {node v18.16 → node v18.17}/readline.d.ts +0 -0
  50. {node v18.16 → node v18.17}/repl.d.ts +0 -0
  51. {node v18.16 → node v18.17}/stream/consumers.d.ts +0 -0
  52. {node v18.16 → node v18.17}/stream/promises.d.ts +0 -0
  53. {node v18.16 → node v18.17}/stream/web.d.ts +0 -0
  54. {node v18.16 → node v18.17}/string_decoder.d.ts +0 -0
  55. {node v18.16 → node v18.17}/timers/promises.d.ts +0 -0
  56. {node v18.16 → node v18.17}/timers.d.ts +0 -0
  57. {node v18.16 → node v18.17}/tls.d.ts +0 -0
  58. {node v18.16 → node v18.17}/trace_events.d.ts +0 -0
  59. {node v18.16 → node v18.17}/ts4.8/assert/strict.d.ts +0 -0
  60. {node v18.16 → node v18.17}/ts4.8/assert.d.ts +0 -0
  61. {node v18.16 → node v18.17}/ts4.8/async_hooks.d.ts +0 -0
  62. {node v18.16 → node v18.17}/ts4.8/buffer.d.ts +0 -0
  63. {node v18.16 → node v18.17}/ts4.8/child_process.d.ts +0 -0
  64. {node v18.16 → node v18.17}/ts4.8/cluster.d.ts +0 -0
  65. {node v18.16 → node v18.17}/ts4.8/console.d.ts +0 -0
  66. {node v18.16 → node v18.17}/ts4.8/constants.d.ts +0 -0
  67. {node v18.16 → node v18.17}/ts4.8/crypto.d.ts +0 -0
  68. {node v18.16 → node v18.17}/ts4.8/dgram.d.ts +0 -0
  69. {node v18.16 → node v18.17}/ts4.8/diagnostics_channel.d.ts +0 -0
  70. {node v18.16 → node v18.17}/ts4.8/dns/promises.d.ts +0 -0
  71. {node v18.16 → node v18.17}/ts4.8/dom-events.d.ts +0 -0
  72. {node v18.16 → node v18.17}/ts4.8/domain.d.ts +0 -0
  73. {node v18.16 → node v18.17}/ts4.8/globals.d.ts +0 -0
  74. {node v18.16 → node v18.17}/ts4.8/globals.global.d.ts +0 -0
  75. {node v18.16 → node v18.17}/ts4.8/http2.d.ts +0 -0
  76. {node v18.16 → node v18.17}/ts4.8/https.d.ts +0 -0
  77. {node v18.16 → node v18.17}/ts4.8/index.d.ts +0 -0
  78. {node v18.16 → node v18.17}/ts4.8/inspector.d.ts +0 -0
  79. {node v18.16 → node v18.17}/ts4.8/module.d.ts +0 -0
  80. {node v18.16 → node v18.17}/ts4.8/net.d.ts +0 -0
  81. {node v18.16 → node v18.17}/ts4.8/os.d.ts +0 -0
  82. {node v18.16 → node v18.17}/ts4.8/path.d.ts +0 -0
  83. {node v18.16 → node v18.17}/ts4.8/perf_hooks.d.ts +0 -0
  84. {node v18.16 → node v18.17}/ts4.8/process.d.ts +0 -0
  85. {node v18.16 → node v18.17}/ts4.8/punycode.d.ts +0 -0
  86. {node v18.16 → node v18.17}/ts4.8/querystring.d.ts +0 -0
  87. {node v18.16 → node v18.17}/ts4.8/readline/promises.d.ts +0 -0
  88. {node v18.16 → node v18.17}/ts4.8/readline.d.ts +0 -0
  89. {node v18.16 → node v18.17}/ts4.8/repl.d.ts +0 -0
  90. {node v18.16 → node v18.17}/ts4.8/stream/consumers.d.ts +0 -0
  91. {node v18.16 → node v18.17}/ts4.8/stream/promises.d.ts +0 -0
  92. {node v18.16 → node v18.17}/ts4.8/stream/web.d.ts +0 -0
  93. {node v18.16 → node v18.17}/ts4.8/string_decoder.d.ts +0 -0
  94. {node v18.16 → node v18.17}/ts4.8/timers/promises.d.ts +0 -0
  95. {node v18.16 → node v18.17}/ts4.8/timers.d.ts +0 -0
  96. {node v18.16 → node v18.17}/ts4.8/tls.d.ts +0 -0
  97. {node v18.16 → node v18.17}/ts4.8/trace_events.d.ts +0 -0
  98. {node v18.16 → node v18.17}/ts4.8/tty.d.ts +0 -0
  99. {node v18.16 → node v18.17}/ts4.8/util.d.ts +0 -0
  100. {node v18.16 → node v18.17}/ts4.8/v8.d.ts +0 -0
  101. {node v18.16 → node v18.17}/ts4.8/vm.d.ts +0 -0
  102. {node v18.16 → node v18.17}/ts4.8/wasi.d.ts +0 -0
  103. {node v18.16 → node v18.17}/ts4.8/worker_threads.d.ts +0 -0
  104. {node v18.16 → node v18.17}/ts4.8/zlib.d.ts +0 -0
  105. {node v18.16 → node v18.17}/tty.d.ts +0 -0
  106. {node v18.16 → node v18.17}/util.d.ts +0 -0
  107. {node v18.16 → node v18.17}/v8.d.ts +0 -0
  108. {node v18.16 → node v18.17}/vm.d.ts +0 -0
  109. {node v18.16 → node v18.17}/wasi.d.ts +0 -0
  110. {node v18.16 → node v18.17}/worker_threads.d.ts +0 -0
  111. {node v18.16 → node v18.17}/zlib.d.ts +0 -0
@@ -484,6 +484,14 @@ declare module 'dns' {
484
484
  * @since v0.1.16
485
485
  */
486
486
  export function reverse(ip: string, callback: (err: NodeJS.ErrnoException | null, hostnames: string[]) => void): void;
487
+ /**
488
+ * Get the default value for `verbatim` in {@link lookup} and `dnsPromises.lookup()`. The value could be:
489
+ *
490
+ * * `ipv4first`: for `verbatim` defaulting to `false`.
491
+ * * `verbatim`: for `verbatim` defaulting to `true`.
492
+ * @since v18.17.0
493
+ */
494
+ export function getDefaultResultOrder(): 'ipv4first' | 'verbatim';
487
495
  /**
488
496
  * Sets the IP address and port of servers to be used when performing DNS
489
497
  * resolution. The `servers` argument is an array of [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6) formatted
@@ -297,6 +297,35 @@ declare module 'events' {
297
297
  * @since v15.2.0, v14.17.0
298
298
  */
299
299
  static getEventListeners(emitter: _DOMEventTarget | NodeJS.EventEmitter, name: string | symbol): Function[];
300
+ /**
301
+ * Returns the currently set max amount of listeners.
302
+ *
303
+ * For `EventEmitter`s this behaves exactly the same as calling `.getMaxListeners` on
304
+ * the emitter.
305
+ *
306
+ * For `EventTarget`s this is the only way to get the max event listeners for the
307
+ * event target. If the number of event handlers on a single EventTarget exceeds
308
+ * the max set, the EventTarget will print a warning.
309
+ *
310
+ * ```js
311
+ * import { getMaxListeners, setMaxListeners, EventEmitter } from 'node:events';
312
+ *
313
+ * {
314
+ * const ee = new EventEmitter();
315
+ * console.log(getMaxListeners(ee)); // 10
316
+ * setMaxListeners(11, ee);
317
+ * console.log(getMaxListeners(ee)); // 11
318
+ * }
319
+ * {
320
+ * const et = new EventTarget();
321
+ * console.log(getMaxListeners(et)); // 10
322
+ * setMaxListeners(11, et);
323
+ * console.log(getMaxListeners(et)); // 11
324
+ * }
325
+ * ```
326
+ * @since v18.17.0
327
+ */
328
+ static getMaxListeners(emitter: _DOMEventTarget | NodeJS.EventEmitter): number;
300
329
  /**
301
330
  * ```js
302
331
  * const {
@@ -14,6 +14,7 @@ declare module 'fs/promises' {
14
14
  import { ReadableStream } from 'node:stream/web';
15
15
  import {
16
16
  BigIntStats,
17
+ BigIntStatsFs,
17
18
  BufferEncodingOption,
18
19
  constants as fsConstants,
19
20
  CopyOptions,
@@ -30,7 +31,9 @@ declare module 'fs/promises' {
30
31
  RmDirOptions,
31
32
  RmOptions,
32
33
  StatOptions,
34
+ StatFsOptions,
33
35
  Stats,
36
+ StatsFs,
34
37
  TimeLike,
35
38
  WatchEventType,
36
39
  WatchOptions,
@@ -80,6 +83,13 @@ declare module 'fs/promises' {
80
83
  emitClose?: boolean | undefined;
81
84
  start?: number | undefined;
82
85
  }
86
+ interface ReadableWebStreamOptions {
87
+ /**
88
+ * Whether to open a normal or a `'bytes'` stream.
89
+ * @since v18.17.0
90
+ */
91
+ type?: 'bytes' | undefined;
92
+ }
83
93
  // TODO: Add `EventEmitter` close
84
94
  interface FileHandle {
85
95
  /**
@@ -236,7 +246,7 @@ declare module 'fs/promises' {
236
246
  * @since v17.0.0
237
247
  * @experimental
238
248
  */
239
- readableWebStream(): ReadableStream;
249
+ readableWebStream(options?: ReadableWebStreamOptions): ReadableStream;
240
250
  /**
241
251
  * Asynchronously reads the entire contents of a file.
242
252
  *
@@ -630,6 +640,7 @@ declare module 'fs/promises' {
630
640
  options?:
631
641
  | (ObjectEncodingOptions & {
632
642
  withFileTypes?: false | undefined;
643
+ recursive?: boolean | undefined;
633
644
  })
634
645
  | BufferEncoding
635
646
  | null
@@ -645,6 +656,7 @@ declare module 'fs/promises' {
645
656
  | {
646
657
  encoding: 'buffer';
647
658
  withFileTypes?: false | undefined;
659
+ recursive?: boolean | undefined;
648
660
  }
649
661
  | 'buffer'
650
662
  ): Promise<Buffer[]>;
@@ -658,6 +670,7 @@ declare module 'fs/promises' {
658
670
  options?:
659
671
  | (ObjectEncodingOptions & {
660
672
  withFileTypes?: false | undefined;
673
+ recursive?: boolean | undefined;
661
674
  })
662
675
  | BufferEncoding
663
676
  | null
@@ -671,6 +684,7 @@ declare module 'fs/promises' {
671
684
  path: PathLike,
672
685
  options: ObjectEncodingOptions & {
673
686
  withFileTypes: true;
687
+ recursive?: boolean | undefined;
674
688
  }
675
689
  ): Promise<Dirent[]>;
676
690
  /**
@@ -745,6 +759,24 @@ declare module 'fs/promises' {
745
759
  }
746
760
  ): Promise<BigIntStats>;
747
761
  function stat(path: PathLike, opts?: StatOptions): Promise<Stats | BigIntStats>;
762
+ /**
763
+ * @since v18.15.0
764
+ * @return Fulfills with an {fs.StatFs} for the file system.
765
+ */
766
+ function statfs(
767
+ path: PathLike,
768
+ opts?: StatFsOptions & {
769
+ bigint?: false | undefined;
770
+ }
771
+ ): Promise<StatsFs>;
772
+ function statfs(
773
+ path: PathLike,
774
+ opts: StatFsOptions & {
775
+ bigint: true;
776
+ }
777
+ ): Promise<BigIntStatsFs>;
778
+ function statfs(path: PathLike, opts?: StatFsOptions): Promise<StatsFs | BigIntStatsFs>;
779
+
748
780
  /**
749
781
  * Creates a new link from the `existingPath` to the `newPath`. See the POSIX [`link(2)`](http://man7.org/linux/man-pages/man2/link.2.html) documentation for more detail.
750
782
  * @since v10.0.0
@@ -131,6 +131,42 @@ declare module 'fs' {
131
131
  * @since v0.1.21
132
132
  */
133
133
  export class Stats {}
134
+
135
+ export interface StatsFsBase<T> {
136
+ /** Type of file system. */
137
+ type: T;
138
+ /** Optimal transfer block size. */
139
+ bsize: T;
140
+ /** Total data blocks in file system. */
141
+ blocks: T;
142
+ /** Free blocks in file system. */
143
+ bfree: T;
144
+ /** Available blocks for unprivileged users */
145
+ bavail: T;
146
+ /** Total file nodes in file system. */
147
+ files: T;
148
+ /** Free file nodes in file system. */
149
+ ffree: T;
150
+ }
151
+
152
+ export interface StatsFs extends StatsFsBase<number> {}
153
+
154
+ /**
155
+ * Provides information about a mounted file system
156
+ *
157
+ * Objects returned from {@link statfs} and {@link statfsSync} are of this type.
158
+ * If `bigint` in the `options` passed to those methods is true, the numeric values
159
+ * will be `bigint` instead of `number`.
160
+ * @since v18.15.0
161
+ */
162
+ export class StatsFs {}
163
+
164
+ export interface BigIntStatsFs extends StatsFsBase<bigint> {}
165
+
166
+ export interface StatFsOptions {
167
+ bigint?: boolean | undefined;
168
+ }
169
+
134
170
  /**
135
171
  * A representation of a directory entry, which can be a file or a subdirectory
136
172
  * within the directory, as returned by reading from an `fs.Dir`. The
@@ -1081,6 +1117,70 @@ declare module 'fs' {
1081
1117
  ): Promise<BigIntStats>;
1082
1118
  function __promisify__(path: PathLike, options?: StatOptions): Promise<Stats | BigIntStats>;
1083
1119
  }
1120
+ /**
1121
+ * Asynchronous statfs(2). Returns information about the mounted file system which contains path. The callback gets two arguments (err, stats) where stats is an <fs.StatFs> object.
1122
+ * In case of an error, the err.code will be one of Common System Errors.
1123
+ * @param path A path to an existing file or directory on the file system to be queried.
1124
+ * @param callback
1125
+ */
1126
+ export function statfs(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: StatsFs) => void): void;
1127
+ export function statfs(
1128
+ path: PathLike,
1129
+ options:
1130
+ | (StatFsOptions & {
1131
+ bigint?: false | undefined;
1132
+ })
1133
+ | undefined,
1134
+ callback: (err: NodeJS.ErrnoException | null, stats: StatsFs) => void
1135
+ ): void;
1136
+ export function statfs(
1137
+ path: PathLike,
1138
+ options: StatFsOptions & {
1139
+ bigint: true;
1140
+ },
1141
+ callback: (err: NodeJS.ErrnoException | null, stats: BigIntStatsFs) => void
1142
+ ): void;
1143
+ export function statfs(path: PathLike, options: StatFsOptions | undefined, callback: (err: NodeJS.ErrnoException | null, stats: StatsFs | BigIntStatsFs) => void): void;
1144
+ export namespace statfs {
1145
+ /**
1146
+ * Asynchronous statfs(2) - Returns information about the mounted file system which contains path. The callback gets two arguments (err, stats) where stats is an <fs.StatFs> object.
1147
+ * @param path A path to an existing file or directory on the file system to be queried.
1148
+ */
1149
+ function __promisify__(
1150
+ path: PathLike,
1151
+ options?: StatFsOptions & {
1152
+ bigint?: false | undefined;
1153
+ }
1154
+ ): Promise<StatsFs>;
1155
+ function __promisify__(
1156
+ path: PathLike,
1157
+ options: StatFsOptions & {
1158
+ bigint: true;
1159
+ }
1160
+ ): Promise<BigIntStatsFs>;
1161
+ function __promisify__(path: PathLike, options?: StatFsOptions): Promise<StatsFs | BigIntStatsFs>;
1162
+ }
1163
+
1164
+ /**
1165
+ * Synchronous statfs(2). Returns information about the mounted file system which contains path. The callback gets two arguments (err, stats) where stats is an <fs.StatFs> object.
1166
+ * In case of an error, the err.code will be one of Common System Errors.
1167
+ * @param path A path to an existing file or directory on the file system to be queried.
1168
+ * @param callback
1169
+ */
1170
+ export function statfsSync(
1171
+ path: PathLike,
1172
+ options?: StatFsOptions & {
1173
+ bigint?: false | undefined;
1174
+ }
1175
+ ): StatsFs;
1176
+ export function statfsSync(
1177
+ path: PathLike,
1178
+ options: StatFsOptions & {
1179
+ bigint: true;
1180
+ }
1181
+ ): BigIntStatsFs;
1182
+
1183
+ export function statfsSync(path: PathLike, options?: StatFsOptions): StatsFs | BigIntStatsFs;
1084
1184
  /**
1085
1185
  * Synchronous lstat(2) - Get file status. Does not dereference symbolic links.
1086
1186
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -1781,6 +1881,7 @@ declare module 'fs' {
1781
1881
  | {
1782
1882
  encoding: BufferEncoding | null;
1783
1883
  withFileTypes?: false | undefined;
1884
+ recursive?: boolean | undefined;
1784
1885
  }
1785
1886
  | BufferEncoding
1786
1887
  | undefined
@@ -1798,6 +1899,7 @@ declare module 'fs' {
1798
1899
  | {
1799
1900
  encoding: 'buffer';
1800
1901
  withFileTypes?: false | undefined;
1902
+ recursive?: boolean | undefined;
1801
1903
  }
1802
1904
  | 'buffer',
1803
1905
  callback: (err: NodeJS.ErrnoException | null, files: Buffer[]) => void
@@ -1812,6 +1914,7 @@ declare module 'fs' {
1812
1914
  options:
1813
1915
  | (ObjectEncodingOptions & {
1814
1916
  withFileTypes?: false | undefined;
1917
+ recursive?: boolean | undefined;
1815
1918
  })
1816
1919
  | BufferEncoding
1817
1920
  | undefined
@@ -1832,6 +1935,7 @@ declare module 'fs' {
1832
1935
  path: PathLike,
1833
1936
  options: ObjectEncodingOptions & {
1834
1937
  withFileTypes: true;
1938
+ recursive?: boolean | undefined;
1835
1939
  },
1836
1940
  callback: (err: NodeJS.ErrnoException | null, files: Dirent[]) => void
1837
1941
  ): void;
@@ -1847,6 +1951,7 @@ declare module 'fs' {
1847
1951
  | {
1848
1952
  encoding: BufferEncoding | null;
1849
1953
  withFileTypes?: false | undefined;
1954
+ recursive?: boolean | undefined;
1850
1955
  }
1851
1956
  | BufferEncoding
1852
1957
  | null
@@ -1863,6 +1968,7 @@ declare module 'fs' {
1863
1968
  | {
1864
1969
  encoding: 'buffer';
1865
1970
  withFileTypes?: false | undefined;
1971
+ recursive?: boolean | undefined;
1866
1972
  }
1867
1973
  ): Promise<Buffer[]>;
1868
1974
  /**
@@ -1875,6 +1981,7 @@ declare module 'fs' {
1875
1981
  options?:
1876
1982
  | (ObjectEncodingOptions & {
1877
1983
  withFileTypes?: false | undefined;
1984
+ recursive?: boolean | undefined;
1878
1985
  })
1879
1986
  | BufferEncoding
1880
1987
  | null
@@ -1888,6 +1995,7 @@ declare module 'fs' {
1888
1995
  path: PathLike,
1889
1996
  options: ObjectEncodingOptions & {
1890
1997
  withFileTypes: true;
1998
+ recursive?: boolean | undefined;
1891
1999
  }
1892
2000
  ): Promise<Dirent[]>;
1893
2001
  }
@@ -1910,6 +2018,7 @@ declare module 'fs' {
1910
2018
  | {
1911
2019
  encoding: BufferEncoding | null;
1912
2020
  withFileTypes?: false | undefined;
2021
+ recursive?: boolean | undefined;
1913
2022
  }
1914
2023
  | BufferEncoding
1915
2024
  | null
@@ -1925,6 +2034,7 @@ declare module 'fs' {
1925
2034
  | {
1926
2035
  encoding: 'buffer';
1927
2036
  withFileTypes?: false | undefined;
2037
+ recursive?: boolean | undefined;
1928
2038
  }
1929
2039
  | 'buffer'
1930
2040
  ): Buffer[];
@@ -1938,6 +2048,7 @@ declare module 'fs' {
1938
2048
  options?:
1939
2049
  | (ObjectEncodingOptions & {
1940
2050
  withFileTypes?: false | undefined;
2051
+ recursive?: boolean | undefined;
1941
2052
  })
1942
2053
  | BufferEncoding
1943
2054
  | null
@@ -1951,6 +2062,7 @@ declare module 'fs' {
1951
2062
  path: PathLike,
1952
2063
  options: ObjectEncodingOptions & {
1953
2064
  withFileTypes: true;
2065
+ recursive?: boolean | undefined;
1954
2066
  }
1955
2067
  ): Dirent[];
1956
2068
  /**
@@ -2913,8 +3025,9 @@ declare module 'fs' {
2913
3025
  /**
2914
3026
  * Watch for changes on `filename`. The callback `listener` will be called each time the file is accessed.
2915
3027
  * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
3028
+ * @param listener The callback listener will be called each time the file is accessed.
2916
3029
  */
2917
- export function watchFile(filename: PathLike, listener: (curr: Stats, prev: Stats) => void): StatWatcher;
3030
+ export function watchFile(filename: PathLike, listener: StatsListener): StatWatcher;
2918
3031
  /**
2919
3032
  * Stop watching for changes on `filename`. If `listener` is specified, only that
2920
3033
  * particular listener is removed. Otherwise, _all_ listeners are removed,
@@ -3813,6 +3926,10 @@ declare module 'fs' {
3813
3926
  * @default true
3814
3927
  */
3815
3928
  force?: boolean;
3929
+ /**
3930
+ * Modifiers for copy operation. See `mode` flag of {@link copyFileSync()}
3931
+ */
3932
+ mode?: number;
3816
3933
  /**
3817
3934
  * When `true` timestamps from `src` will
3818
3935
  * be preserved.
@@ -42,8 +42,9 @@
42
42
  declare module 'http' {
43
43
  import * as stream from 'node:stream';
44
44
  import { URL } from 'node:url';
45
- import { TcpSocketConnectOpts, Socket, Server as NetServer, LookupFunction } from 'node:net';
45
+ import { EventEmitter } from 'node:events';
46
46
  import { LookupOptions } from 'node:dns';
47
+ import { TcpSocketConnectOpts, Socket, Server as NetServer, LookupFunction } from 'node:net';
47
48
  // incoming headers will never contain number
48
49
  interface IncomingHttpHeaders extends NodeJS.Dict<string | string[]> {
49
50
  accept?: string | undefined;
@@ -144,6 +145,7 @@ declare module 'http' {
144
145
  socketPath?: string | undefined;
145
146
  timeout?: number | undefined;
146
147
  uniqueHeaders?: Array<string | string[]> | undefined;
148
+ joinDuplicateHeaders?: boolean;
147
149
  }
148
150
  interface ServerOptions<
149
151
  Request extends typeof IncomingMessage = typeof IncomingMessage,
@@ -164,6 +166,12 @@ declare module 'http' {
164
166
  * @since v18.0.0
165
167
  */
166
168
  requestTimeout?: number | undefined;
169
+ /**
170
+ * It joins the field line values of multiple headers in a request with `, ` instead of discarding the duplicates.
171
+ * @default false
172
+ * @since v18.14.0
173
+ */
174
+ joinDuplicateHeaders?: boolean;
167
175
  /**
168
176
  * The number of milliseconds of inactivity a server needs to wait for additional incoming data,
169
177
  * after it has finished writing the last response, before a socket will be destroyed.
@@ -177,6 +185,13 @@ declare module 'http' {
177
185
  * @default 30000
178
186
  */
179
187
  connectionsCheckingInterval?: number | undefined;
188
+ /**
189
+ * Optionally overrides all `socket`s' `readableHighWaterMark` and `writableHighWaterMark`.
190
+ * This affects `highWaterMark` property of both `IncomingMessage` and `ServerResponse`.
191
+ * Default: @see stream.getDefaultHighWaterMark().
192
+ * @since v18.17.0
193
+ */
194
+ highWaterMark?: number | undefined;
180
195
  /**
181
196
  * Use an insecure HTTP parser that accepts invalid HTTP headers when `true`.
182
197
  * Using the insecure parser should be avoided.
@@ -338,6 +353,7 @@ declare module 'http' {
338
353
  event: 'connect',
339
354
  listener: (req: InstanceType<Request>, socket: stream.Duplex, head: Buffer) => void,
340
355
  ): this;
356
+ addListener(event: 'dropRequest', listener: (req: InstanceType<Request>, socket: stream.Duplex) => void): this;
341
357
  addListener(event: 'request', listener: RequestListener<Request, Response>): this;
342
358
  addListener(
343
359
  event: 'upgrade',
@@ -360,6 +376,7 @@ declare module 'http' {
360
376
  ): boolean;
361
377
  emit(event: 'clientError', err: Error, socket: stream.Duplex): boolean;
362
378
  emit(event: 'connect', req: InstanceType<Request>, socket: stream.Duplex, head: Buffer): boolean;
379
+ emit(event: 'dropRequest', req: InstanceType<Request>, socket: stream.Duplex): boolean;
363
380
  emit(
364
381
  event: 'request',
365
382
  req: InstanceType<Request>,
@@ -375,6 +392,7 @@ declare module 'http' {
375
392
  on(event: 'checkExpectation', listener: RequestListener<Request, Response>): this;
376
393
  on(event: 'clientError', listener: (err: Error, socket: stream.Duplex) => void): this;
377
394
  on(event: 'connect', listener: (req: InstanceType<Request>, socket: stream.Duplex, head: Buffer) => void): this;
395
+ on(event: 'dropRequest', listener: (req: InstanceType<Request>, socket: stream.Duplex) => void): this;
378
396
  on(event: 'request', listener: RequestListener<Request, Response>): this;
379
397
  on(event: 'upgrade', listener: (req: InstanceType<Request>, socket: stream.Duplex, head: Buffer) => void): this;
380
398
  once(event: string, listener: (...args: any[]) => void): this;
@@ -389,6 +407,7 @@ declare module 'http' {
389
407
  event: 'connect',
390
408
  listener: (req: InstanceType<Request>, socket: stream.Duplex, head: Buffer) => void,
391
409
  ): this;
410
+ once(event: 'dropRequest', listener: (req: InstanceType<Request>, socket: stream.Duplex) => void): this;
392
411
  once(event: 'request', listener: RequestListener<Request, Response>): this;
393
412
  once(
394
413
  event: 'upgrade',
@@ -406,6 +425,10 @@ declare module 'http' {
406
425
  event: 'connect',
407
426
  listener: (req: InstanceType<Request>, socket: stream.Duplex, head: Buffer) => void,
408
427
  ): this;
428
+ prependListener(
429
+ event: 'dropRequest',
430
+ listener: (req: InstanceType<Request>, socket: stream.Duplex) => void,
431
+ ): this;
409
432
  prependListener(event: 'request', listener: RequestListener<Request, Response>): this;
410
433
  prependListener(
411
434
  event: 'upgrade',
@@ -423,6 +446,10 @@ declare module 'http' {
423
446
  event: 'connect',
424
447
  listener: (req: InstanceType<Request>, socket: stream.Duplex, head: Buffer) => void,
425
448
  ): this;
449
+ prependOnceListener(
450
+ event: 'dropRequest',
451
+ listener: (req: InstanceType<Request>, socket: stream.Duplex) => void,
452
+ ): this;
426
453
  prependOnceListener(event: 'request', listener: RequestListener<Request, Response>): this;
427
454
  prependOnceListener(
428
455
  event: 'upgrade',
@@ -472,11 +499,26 @@ declare module 'http' {
472
499
  setTimeout(msecs: number, callback?: () => void): this;
473
500
  /**
474
501
  * Sets a single header value for the header object.
502
+ * If the header already exists in the to-be-sent headers, its value will be replaced. Use an array of strings to send multiple headers with the same name.
475
503
  * @since v0.4.0
476
504
  * @param name Header name
477
505
  * @param value Header value
478
506
  */
479
507
  setHeader(name: string, value: number | string | ReadonlyArray<string>): this;
508
+ /**
509
+ * Append a single header value for the header object.
510
+ *
511
+ * If the value is an array, this is equivalent of calling this method multiple times.
512
+ *
513
+ * If there were no previous value for the header, this is equivalent of calling `outgoingMessage.setHeader(name, value)`.
514
+ *
515
+ * Depending of the value of `options.uniqueHeaders` when the client request or the server were created,
516
+ * this will end up in the header being sent multiple times or a single time with values joined using `; `.
517
+ * @since v18.3.0, v16.17.0
518
+ * @param name Header name
519
+ * @param value Header value
520
+ */
521
+ appendHeader(name: string, value: string | ReadonlyArray<string>): this;
480
522
  /**
481
523
  * Gets the value of HTTP header with the given name. If such a name doesn't
482
524
  * exist in message, it will be `undefined`.
@@ -603,6 +645,14 @@ declare module 'http' {
603
645
  * @since v0.11.8
604
646
  */
605
647
  statusMessage: string;
648
+ /**
649
+ * If set to `true`, Node.js will check whether the `Content-Length` header value
650
+ * and the size of the body, in bytes, are equal. Mismatching the
651
+ * `Content-Length` header value will result in an `Error` being thrown,
652
+ * identified by `code: 'ERR_HTTP_CONTENT_LENGTH_MISMATCH'`.
653
+ * @since v18.10.0, v16.18.0
654
+ */
655
+ strictContentLength: boolean;
606
656
  constructor(req: Request);
607
657
  assignSocket(socket: Socket): void;
608
658
  detachSocket(socket: Socket): void;
@@ -1083,6 +1133,20 @@ declare module 'http' {
1083
1133
  * @since v0.1.5
1084
1134
  */
1085
1135
  headers: IncomingHttpHeaders;
1136
+ /**
1137
+ * Similar to `message.headers`, but there is no join logic and the values are always arrays of strings, even for headers received just once.
1138
+ *
1139
+ * ```js
1140
+ * // Prints something like:
1141
+ * //
1142
+ * // { 'user-agent': ['curl/7.22.0'],
1143
+ * // host: ['127.0.0.1:8000'],
1144
+ * // accept: ['*'] }
1145
+ * console.log(request.headersDistinct);
1146
+ * ```
1147
+ * @since v18.3.0, v16.17.0
1148
+ */
1149
+ headersDistinct: NodeJS.Dict<string[]>;
1086
1150
  /**
1087
1151
  * The raw request/response headers list exactly as they were received.
1088
1152
  *
@@ -1113,6 +1177,12 @@ declare module 'http' {
1113
1177
  * @since v0.3.0
1114
1178
  */
1115
1179
  trailers: NodeJS.Dict<string>;
1180
+ /**
1181
+ * Similar to `message.trailers`, but there is no join logic and the values are always arrays of strings, even for headers received just once.
1182
+ * Only populated at the `'end'` event.
1183
+ * @since v18.3.0, v16.17.0
1184
+ */
1185
+ trailersDistinct: NodeJS.Dict<string[]>;
1116
1186
  /**
1117
1187
  * The raw request/response trailer keys and values exactly as they were
1118
1188
  * received. Only populated at the `'end'` event.
@@ -1279,9 +1349,9 @@ declare module 'http' {
1279
1349
  * ```
1280
1350
  * @since v0.3.4
1281
1351
  */
1282
- class Agent {
1352
+ class Agent extends EventEmitter {
1283
1353
  /**
1284
- * By default set to 256\. For agents with `keepAlive` enabled, this
1354
+ * By default set to 256. For agents with `keepAlive` enabled, this
1285
1355
  * sets the maximum number of sockets that will be left open in the free
1286
1356
  * state.
1287
1357
  * @since v0.11.7
@@ -124,12 +124,12 @@ declare module 'stream' {
124
124
  readonly readableObjectMode: boolean;
125
125
  /**
126
126
  * Is `true` after `readable.destroy()` has been called.
127
- * @since v18.0.0
127
+ * @since v8.0.0
128
128
  */
129
129
  destroyed: boolean;
130
130
  /**
131
131
  * Is true after 'close' has been emitted.
132
- * @since v8.0.0
132
+ * @since v18.0.0
133
133
  */
134
134
  readonly closed: boolean;
135
135
  /**
@@ -579,7 +579,7 @@ declare module 'stream' {
579
579
  destroyed: boolean;
580
580
  /**
581
581
  * Is true after 'close' has been emitted.
582
- * @since v8.0.0
582
+ * @since v18.0.0
583
583
  */
584
584
  readonly closed: boolean;
585
585
  /**
@@ -1097,6 +1097,20 @@ declare module 'stream' {
1097
1097
  * @param stream a stream to attach a signal to
1098
1098
  */
1099
1099
  function addAbortSignal<T extends Stream>(signal: AbortSignal, stream: T): T;
1100
+ /**
1101
+ * Returns the default highWaterMark used by streams.
1102
+ * Defaults to `16384` (16 KiB), or `16` for `objectMode`.
1103
+ * @since v18.17.0
1104
+ * @param objectMode
1105
+ */
1106
+ function getDefaultHighWaterMark(objectMode: boolean): number;
1107
+ /**
1108
+ * Sets the default highWaterMark used by streams.
1109
+ * @since v18.17.0
1110
+ * @param objectMode
1111
+ * @param value highWaterMark value
1112
+ */
1113
+ function setDefaultHighWaterMark(objectMode: boolean, value: number): void;
1100
1114
  interface FinishedOptions extends Abortable {
1101
1115
  error?: boolean | undefined;
1102
1116
  readable?: boolean | undefined;