cdk-common 2.0.1351 → 2.0.1353

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 (168) hide show
  1. package/.jsii +38 -2
  2. package/API.md +36 -0
  3. package/lib/main.js +1 -1
  4. package/lib/managed-policies.d.ts +7 -1
  5. package/lib/managed-policies.js +7 -1
  6. package/node_modules/@types/concat-stream/node_modules/@types/node/README.md +1 -1
  7. package/node_modules/@types/concat-stream/node_modules/@types/node/assert/strict.d.ts +5 -11
  8. package/node_modules/@types/concat-stream/node_modules/@types/node/assert.d.ts +9 -169
  9. package/node_modules/@types/concat-stream/node_modules/@types/node/async_hooks.d.ts +8 -8
  10. package/node_modules/@types/concat-stream/node_modules/@types/node/buffer.buffer.d.ts +1 -7
  11. package/node_modules/@types/concat-stream/node_modules/@types/node/buffer.d.ts +44 -168
  12. package/node_modules/@types/concat-stream/node_modules/@types/node/child_process.d.ts +16 -64
  13. package/node_modules/@types/concat-stream/node_modules/@types/node/cluster.d.ts +240 -332
  14. package/node_modules/@types/concat-stream/node_modules/@types/node/console.d.ts +49 -351
  15. package/node_modules/@types/concat-stream/node_modules/@types/node/constants.d.ts +3 -4
  16. package/node_modules/@types/concat-stream/node_modules/@types/node/crypto.d.ts +279 -1631
  17. package/node_modules/@types/concat-stream/node_modules/@types/node/dgram.d.ts +15 -51
  18. package/node_modules/@types/concat-stream/node_modules/@types/node/diagnostics_channel.d.ts +4 -4
  19. package/node_modules/@types/concat-stream/node_modules/@types/node/dns/promises.d.ts +3 -3
  20. package/node_modules/@types/concat-stream/node_modules/@types/node/dns.d.ts +131 -132
  21. package/node_modules/@types/concat-stream/node_modules/@types/node/domain.d.ts +13 -17
  22. package/node_modules/@types/concat-stream/node_modules/@types/node/events.d.ts +869 -791
  23. package/node_modules/@types/concat-stream/node_modules/@types/node/fs/promises.d.ts +7 -8
  24. package/node_modules/@types/concat-stream/node_modules/@types/node/fs.d.ts +417 -455
  25. package/node_modules/@types/concat-stream/node_modules/@types/node/globals.d.ts +6 -26
  26. package/node_modules/@types/concat-stream/node_modules/@types/node/globals.typedarray.d.ts +60 -0
  27. package/node_modules/@types/concat-stream/node_modules/@types/node/http.d.ts +263 -254
  28. package/node_modules/@types/concat-stream/node_modules/@types/node/http2.d.ts +528 -804
  29. package/node_modules/@types/concat-stream/node_modules/@types/node/https.d.ts +59 -239
  30. package/node_modules/@types/concat-stream/node_modules/@types/node/index.d.ts +15 -1
  31. package/node_modules/@types/concat-stream/node_modules/@types/node/inspector/promises.d.ts +41 -0
  32. package/node_modules/@types/concat-stream/node_modules/@types/node/inspector.d.ts +6 -59
  33. package/node_modules/@types/concat-stream/node_modules/@types/node/inspector.generated.d.ts +3 -10
  34. package/node_modules/@types/concat-stream/node_modules/@types/node/module.d.ts +47 -122
  35. package/node_modules/@types/concat-stream/node_modules/@types/node/net.d.ts +63 -184
  36. package/node_modules/@types/concat-stream/node_modules/@types/node/os.d.ts +6 -6
  37. package/node_modules/@types/concat-stream/node_modules/@types/node/package.json +2 -2
  38. package/node_modules/@types/concat-stream/node_modules/@types/node/path/posix.d.ts +8 -0
  39. package/node_modules/@types/concat-stream/node_modules/@types/node/path/win32.d.ts +8 -0
  40. package/node_modules/@types/concat-stream/node_modules/@types/node/path.d.ts +120 -133
  41. package/node_modules/@types/concat-stream/node_modules/@types/node/perf_hooks.d.ts +282 -643
  42. package/node_modules/@types/concat-stream/node_modules/@types/node/process.d.ts +156 -128
  43. package/node_modules/@types/concat-stream/node_modules/@types/node/punycode.d.ts +5 -5
  44. package/node_modules/@types/concat-stream/node_modules/@types/node/querystring.d.ts +4 -4
  45. package/node_modules/@types/concat-stream/node_modules/@types/node/quic.d.ts +910 -0
  46. package/node_modules/@types/concat-stream/node_modules/@types/node/readline/promises.d.ts +3 -3
  47. package/node_modules/@types/concat-stream/node_modules/@types/node/readline.d.ts +67 -120
  48. package/node_modules/@types/concat-stream/node_modules/@types/node/repl.d.ts +75 -98
  49. package/node_modules/@types/concat-stream/node_modules/@types/node/sea.d.ts +1 -1
  50. package/node_modules/@types/concat-stream/node_modules/@types/node/sqlite.d.ts +2 -2
  51. package/node_modules/@types/concat-stream/node_modules/@types/node/stream/consumers.d.ts +10 -10
  52. package/node_modules/@types/concat-stream/node_modules/@types/node/stream/promises.d.ts +136 -15
  53. package/node_modules/@types/concat-stream/node_modules/@types/node/stream/web.d.ts +176 -453
  54. package/node_modules/@types/concat-stream/node_modules/@types/node/stream.d.ts +555 -478
  55. package/node_modules/@types/concat-stream/node_modules/@types/node/string_decoder.d.ts +4 -4
  56. package/node_modules/@types/concat-stream/node_modules/@types/node/test/reporters.d.ts +96 -0
  57. package/node_modules/@types/concat-stream/node_modules/@types/node/test.d.ts +80 -180
  58. package/node_modules/@types/concat-stream/node_modules/@types/node/timers/promises.d.ts +4 -4
  59. package/node_modules/@types/concat-stream/node_modules/@types/node/timers.d.ts +4 -130
  60. package/node_modules/@types/concat-stream/node_modules/@types/node/tls.d.ts +102 -177
  61. package/node_modules/@types/concat-stream/node_modules/@types/node/trace_events.d.ts +9 -9
  62. package/node_modules/@types/concat-stream/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +1 -7
  63. package/node_modules/@types/concat-stream/node_modules/@types/node/ts5.6/index.d.ts +15 -1
  64. package/node_modules/@types/concat-stream/node_modules/@types/node/ts5.7/index.d.ts +15 -1
  65. package/node_modules/@types/concat-stream/node_modules/@types/node/tty.d.ts +58 -16
  66. package/node_modules/@types/concat-stream/node_modules/@types/node/url.d.ts +54 -592
  67. package/node_modules/@types/concat-stream/node_modules/@types/node/util/types.d.ts +558 -0
  68. package/node_modules/@types/concat-stream/node_modules/@types/node/util.d.ts +120 -792
  69. package/node_modules/@types/concat-stream/node_modules/@types/node/v8.d.ts +32 -5
  70. package/node_modules/@types/concat-stream/node_modules/@types/node/vm.d.ts +13 -13
  71. package/node_modules/@types/concat-stream/node_modules/@types/node/wasi.d.ts +4 -4
  72. package/node_modules/@types/concat-stream/node_modules/@types/node/web-globals/abortcontroller.d.ts +27 -2
  73. package/node_modules/@types/concat-stream/node_modules/@types/node/web-globals/blob.d.ts +23 -0
  74. package/node_modules/@types/concat-stream/node_modules/@types/node/web-globals/console.d.ts +9 -0
  75. package/node_modules/@types/concat-stream/node_modules/@types/node/web-globals/crypto.d.ts +7 -0
  76. package/node_modules/@types/concat-stream/node_modules/@types/node/web-globals/encoding.d.ts +11 -0
  77. package/node_modules/@types/concat-stream/node_modules/@types/node/web-globals/events.d.ts +9 -0
  78. package/node_modules/@types/concat-stream/node_modules/@types/node/web-globals/fetch.d.ts +4 -0
  79. package/node_modules/@types/concat-stream/node_modules/@types/node/web-globals/importmeta.d.ts +13 -0
  80. package/node_modules/@types/concat-stream/node_modules/@types/node/web-globals/messaging.d.ts +23 -0
  81. package/node_modules/@types/concat-stream/node_modules/@types/node/web-globals/performance.d.ts +45 -0
  82. package/node_modules/@types/concat-stream/node_modules/@types/node/web-globals/streams.d.ts +93 -0
  83. package/node_modules/@types/concat-stream/node_modules/@types/node/web-globals/timers.d.ts +44 -0
  84. package/node_modules/@types/concat-stream/node_modules/@types/node/web-globals/url.d.ts +24 -0
  85. package/node_modules/@types/concat-stream/node_modules/@types/node/worker_threads.d.ts +176 -358
  86. package/node_modules/@types/concat-stream/node_modules/@types/node/zlib.d.ts +8 -71
  87. package/node_modules/@types/form-data/node_modules/@types/node/README.md +1 -1
  88. package/node_modules/@types/form-data/node_modules/@types/node/assert/strict.d.ts +5 -11
  89. package/node_modules/@types/form-data/node_modules/@types/node/assert.d.ts +9 -169
  90. package/node_modules/@types/form-data/node_modules/@types/node/async_hooks.d.ts +8 -8
  91. package/node_modules/@types/form-data/node_modules/@types/node/buffer.buffer.d.ts +1 -7
  92. package/node_modules/@types/form-data/node_modules/@types/node/buffer.d.ts +44 -168
  93. package/node_modules/@types/form-data/node_modules/@types/node/child_process.d.ts +16 -64
  94. package/node_modules/@types/form-data/node_modules/@types/node/cluster.d.ts +240 -332
  95. package/node_modules/@types/form-data/node_modules/@types/node/console.d.ts +49 -351
  96. package/node_modules/@types/form-data/node_modules/@types/node/constants.d.ts +3 -4
  97. package/node_modules/@types/form-data/node_modules/@types/node/crypto.d.ts +279 -1631
  98. package/node_modules/@types/form-data/node_modules/@types/node/dgram.d.ts +15 -51
  99. package/node_modules/@types/form-data/node_modules/@types/node/diagnostics_channel.d.ts +4 -4
  100. package/node_modules/@types/form-data/node_modules/@types/node/dns/promises.d.ts +3 -3
  101. package/node_modules/@types/form-data/node_modules/@types/node/dns.d.ts +131 -132
  102. package/node_modules/@types/form-data/node_modules/@types/node/domain.d.ts +13 -17
  103. package/node_modules/@types/form-data/node_modules/@types/node/events.d.ts +869 -791
  104. package/node_modules/@types/form-data/node_modules/@types/node/fs/promises.d.ts +7 -8
  105. package/node_modules/@types/form-data/node_modules/@types/node/fs.d.ts +417 -455
  106. package/node_modules/@types/form-data/node_modules/@types/node/globals.d.ts +6 -26
  107. package/node_modules/@types/form-data/node_modules/@types/node/globals.typedarray.d.ts +60 -0
  108. package/node_modules/@types/form-data/node_modules/@types/node/http.d.ts +263 -254
  109. package/node_modules/@types/form-data/node_modules/@types/node/http2.d.ts +528 -804
  110. package/node_modules/@types/form-data/node_modules/@types/node/https.d.ts +59 -239
  111. package/node_modules/@types/form-data/node_modules/@types/node/index.d.ts +15 -1
  112. package/node_modules/@types/form-data/node_modules/@types/node/inspector/promises.d.ts +41 -0
  113. package/node_modules/@types/form-data/node_modules/@types/node/inspector.d.ts +6 -59
  114. package/node_modules/@types/form-data/node_modules/@types/node/inspector.generated.d.ts +3 -10
  115. package/node_modules/@types/form-data/node_modules/@types/node/module.d.ts +47 -122
  116. package/node_modules/@types/form-data/node_modules/@types/node/net.d.ts +63 -184
  117. package/node_modules/@types/form-data/node_modules/@types/node/os.d.ts +6 -6
  118. package/node_modules/@types/form-data/node_modules/@types/node/package.json +2 -2
  119. package/node_modules/@types/form-data/node_modules/@types/node/path/posix.d.ts +8 -0
  120. package/node_modules/@types/form-data/node_modules/@types/node/path/win32.d.ts +8 -0
  121. package/node_modules/@types/form-data/node_modules/@types/node/path.d.ts +120 -133
  122. package/node_modules/@types/form-data/node_modules/@types/node/perf_hooks.d.ts +282 -643
  123. package/node_modules/@types/form-data/node_modules/@types/node/process.d.ts +156 -128
  124. package/node_modules/@types/form-data/node_modules/@types/node/punycode.d.ts +5 -5
  125. package/node_modules/@types/form-data/node_modules/@types/node/querystring.d.ts +4 -4
  126. package/node_modules/@types/form-data/node_modules/@types/node/quic.d.ts +910 -0
  127. package/node_modules/@types/form-data/node_modules/@types/node/readline/promises.d.ts +3 -3
  128. package/node_modules/@types/form-data/node_modules/@types/node/readline.d.ts +67 -120
  129. package/node_modules/@types/form-data/node_modules/@types/node/repl.d.ts +75 -98
  130. package/node_modules/@types/form-data/node_modules/@types/node/sea.d.ts +1 -1
  131. package/node_modules/@types/form-data/node_modules/@types/node/sqlite.d.ts +2 -2
  132. package/node_modules/@types/form-data/node_modules/@types/node/stream/consumers.d.ts +10 -10
  133. package/node_modules/@types/form-data/node_modules/@types/node/stream/promises.d.ts +136 -15
  134. package/node_modules/@types/form-data/node_modules/@types/node/stream/web.d.ts +176 -453
  135. package/node_modules/@types/form-data/node_modules/@types/node/stream.d.ts +555 -478
  136. package/node_modules/@types/form-data/node_modules/@types/node/string_decoder.d.ts +4 -4
  137. package/node_modules/@types/form-data/node_modules/@types/node/test/reporters.d.ts +96 -0
  138. package/node_modules/@types/form-data/node_modules/@types/node/test.d.ts +80 -180
  139. package/node_modules/@types/form-data/node_modules/@types/node/timers/promises.d.ts +4 -4
  140. package/node_modules/@types/form-data/node_modules/@types/node/timers.d.ts +4 -130
  141. package/node_modules/@types/form-data/node_modules/@types/node/tls.d.ts +102 -177
  142. package/node_modules/@types/form-data/node_modules/@types/node/trace_events.d.ts +9 -9
  143. package/node_modules/@types/form-data/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +1 -7
  144. package/node_modules/@types/form-data/node_modules/@types/node/ts5.6/index.d.ts +15 -1
  145. package/node_modules/@types/form-data/node_modules/@types/node/ts5.7/index.d.ts +15 -1
  146. package/node_modules/@types/form-data/node_modules/@types/node/tty.d.ts +58 -16
  147. package/node_modules/@types/form-data/node_modules/@types/node/url.d.ts +54 -592
  148. package/node_modules/@types/form-data/node_modules/@types/node/util/types.d.ts +558 -0
  149. package/node_modules/@types/form-data/node_modules/@types/node/util.d.ts +120 -792
  150. package/node_modules/@types/form-data/node_modules/@types/node/v8.d.ts +32 -5
  151. package/node_modules/@types/form-data/node_modules/@types/node/vm.d.ts +13 -13
  152. package/node_modules/@types/form-data/node_modules/@types/node/wasi.d.ts +4 -4
  153. package/node_modules/@types/form-data/node_modules/@types/node/web-globals/abortcontroller.d.ts +27 -2
  154. package/node_modules/@types/form-data/node_modules/@types/node/web-globals/blob.d.ts +23 -0
  155. package/node_modules/@types/form-data/node_modules/@types/node/web-globals/console.d.ts +9 -0
  156. package/node_modules/@types/form-data/node_modules/@types/node/web-globals/crypto.d.ts +7 -0
  157. package/node_modules/@types/form-data/node_modules/@types/node/web-globals/encoding.d.ts +11 -0
  158. package/node_modules/@types/form-data/node_modules/@types/node/web-globals/events.d.ts +9 -0
  159. package/node_modules/@types/form-data/node_modules/@types/node/web-globals/fetch.d.ts +4 -0
  160. package/node_modules/@types/form-data/node_modules/@types/node/web-globals/importmeta.d.ts +13 -0
  161. package/node_modules/@types/form-data/node_modules/@types/node/web-globals/messaging.d.ts +23 -0
  162. package/node_modules/@types/form-data/node_modules/@types/node/web-globals/performance.d.ts +45 -0
  163. package/node_modules/@types/form-data/node_modules/@types/node/web-globals/streams.d.ts +93 -0
  164. package/node_modules/@types/form-data/node_modules/@types/node/web-globals/timers.d.ts +44 -0
  165. package/node_modules/@types/form-data/node_modules/@types/node/web-globals/url.d.ts +24 -0
  166. package/node_modules/@types/form-data/node_modules/@types/node/worker_threads.d.ts +176 -358
  167. package/node_modules/@types/form-data/node_modules/@types/node/zlib.d.ts +8 -71
  168. package/package.json +4 -4
@@ -16,34 +16,33 @@
16
16
  *
17
17
  * All file system operations have synchronous, callback, and promise-based
18
18
  * forms, and are accessible using both CommonJS syntax and ES6 Modules (ESM).
19
- * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/fs.js)
19
+ * @see [source](https://github.com/nodejs/node/blob/v25.x/lib/fs.js)
20
20
  */
21
- declare module "fs" {
21
+ declare module "node:fs" {
22
22
  import { NonSharedBuffer } from "node:buffer";
23
+ import { Abortable, EventEmitter, InternalEventEmitter } from "node:events";
24
+ import { FileHandle } from "node:fs/promises";
23
25
  import * as stream from "node:stream";
24
- import { Abortable, EventEmitter } from "node:events";
25
26
  import { URL } from "node:url";
26
- import * as promises from "node:fs/promises";
27
- export { promises };
28
27
  /**
29
28
  * Valid types for path values in "fs".
30
29
  */
31
- export type PathLike = string | Buffer | URL;
32
- export type PathOrFileDescriptor = PathLike | number;
33
- export type TimeLike = string | number | Date;
34
- export type NoParamCallback = (err: NodeJS.ErrnoException | null) => void;
35
- export type BufferEncodingOption =
30
+ type PathLike = string | Buffer | URL;
31
+ type PathOrFileDescriptor = PathLike | number;
32
+ type TimeLike = string | number | Date;
33
+ type NoParamCallback = (err: NodeJS.ErrnoException | null) => void;
34
+ type BufferEncodingOption =
36
35
  | "buffer"
37
36
  | {
38
37
  encoding: "buffer";
39
38
  };
40
- export interface ObjectEncodingOptions {
39
+ interface ObjectEncodingOptions {
41
40
  encoding?: BufferEncoding | null | undefined;
42
41
  }
43
- export type EncodingOption = ObjectEncodingOptions | BufferEncoding | undefined | null;
44
- export type OpenMode = number | string;
45
- export type Mode = number | string;
46
- export interface StatsBase<T> {
42
+ type EncodingOption = ObjectEncodingOptions | BufferEncoding | undefined | null;
43
+ type OpenMode = number | string;
44
+ type Mode = number | string;
45
+ interface StatsBase<T> {
47
46
  isFile(): boolean;
48
47
  isDirectory(): boolean;
49
48
  isBlockDevice(): boolean;
@@ -70,7 +69,7 @@ declare module "fs" {
70
69
  ctime: Date;
71
70
  birthtime: Date;
72
71
  }
73
- export interface Stats extends StatsBase<number> {}
72
+ interface Stats extends StatsBase<number> {}
74
73
  /**
75
74
  * A `fs.Stats` object provides information about a file.
76
75
  *
@@ -131,10 +130,10 @@ declare module "fs" {
131
130
  * ```
132
131
  * @since v0.1.21
133
132
  */
134
- export class Stats {
133
+ class Stats {
135
134
  private constructor();
136
135
  }
137
- export interface StatsFsBase<T> {
136
+ interface StatsFsBase<T> {
138
137
  /** Type of file system. */
139
138
  type: T;
140
139
  /** Optimal transfer block size. */
@@ -150,7 +149,7 @@ declare module "fs" {
150
149
  /** Free file nodes in file system. */
151
150
  ffree: T;
152
151
  }
153
- export interface StatsFs extends StatsFsBase<number> {}
152
+ interface StatsFs extends StatsFsBase<number> {}
154
153
  /**
155
154
  * Provides information about a mounted file system.
156
155
  *
@@ -185,9 +184,9 @@ declare module "fs" {
185
184
  * ```
186
185
  * @since v19.6.0, v18.15.0
187
186
  */
188
- export class StatsFs {}
189
- export interface BigIntStatsFs extends StatsFsBase<bigint> {}
190
- export interface StatFsOptions {
187
+ class StatsFs {}
188
+ interface BigIntStatsFs extends StatsFsBase<bigint> {}
189
+ interface StatFsOptions {
191
190
  bigint?: boolean | undefined;
192
191
  }
193
192
  /**
@@ -199,7 +198,7 @@ declare module "fs" {
199
198
  * the `withFileTypes` option set to `true`, the resulting array is filled with `fs.Dirent` objects, rather than strings or `Buffer` s.
200
199
  * @since v10.10.0
201
200
  */
202
- export class Dirent<Name extends string | Buffer = string> {
201
+ class Dirent<Name extends string | Buffer = string> {
203
202
  /**
204
203
  * Returns `true` if the `fs.Dirent` object describes a regular file.
205
204
  * @since v10.10.0
@@ -270,7 +269,7 @@ declare module "fs" {
270
269
  * closed after the iterator exits.
271
270
  * @since v12.12.0
272
271
  */
273
- export class Dir implements AsyncIterable<Dirent> {
272
+ class Dir implements AsyncIterable<Dirent> {
274
273
  /**
275
274
  * The read-only path of this directory as was provided to {@link opendir},{@link opendirSync}, or `fsPromises.opendir()`.
276
275
  * @since v12.12.0
@@ -342,7 +341,7 @@ declare module "fs" {
342
341
  * Extends `EventEmitter`
343
342
  * A successful call to {@link watchFile} method will return a new fs.StatWatcher object.
344
343
  */
345
- export interface StatWatcher extends EventEmitter {
344
+ interface StatWatcher extends EventEmitter {
346
345
  /**
347
346
  * When called, requests that the Node.js event loop _not_ exit so long as the `fs.StatWatcher` is active. Calling `watcher.ref()` multiple times will have
348
347
  * no effect.
@@ -363,7 +362,12 @@ declare module "fs" {
363
362
  */
364
363
  unref(): this;
365
364
  }
366
- export interface FSWatcher extends EventEmitter {
365
+ interface FSWatcherEventMap {
366
+ "change": [eventType: string, filename: string | NonSharedBuffer];
367
+ "close": [];
368
+ "error": [error: Error];
369
+ }
370
+ interface FSWatcher extends InternalEventEmitter<FSWatcherEventMap> {
367
371
  /**
368
372
  * Stop watching for changes on the given `fs.FSWatcher`. Once stopped, the `fs.FSWatcher` object is no longer usable.
369
373
  * @since v0.5.8
@@ -388,44 +392,18 @@ declare module "fs" {
388
392
  * @since v14.3.0, v12.20.0
389
393
  */
390
394
  unref(): this;
391
- /**
392
- * events.EventEmitter
393
- * 1. change
394
- * 2. close
395
- * 3. error
396
- */
397
- addListener(event: string, listener: (...args: any[]) => void): this;
398
- addListener(event: "change", listener: (eventType: string, filename: string | NonSharedBuffer) => void): this;
399
- addListener(event: "close", listener: () => void): this;
400
- addListener(event: "error", listener: (error: Error) => void): this;
401
- on(event: string, listener: (...args: any[]) => void): this;
402
- on(event: "change", listener: (eventType: string, filename: string | NonSharedBuffer) => void): this;
403
- on(event: "close", listener: () => void): this;
404
- on(event: "error", listener: (error: Error) => void): this;
405
- once(event: string, listener: (...args: any[]) => void): this;
406
- once(event: "change", listener: (eventType: string, filename: string | NonSharedBuffer) => void): this;
407
- once(event: "close", listener: () => void): this;
408
- once(event: "error", listener: (error: Error) => void): this;
409
- prependListener(event: string, listener: (...args: any[]) => void): this;
410
- prependListener(
411
- event: "change",
412
- listener: (eventType: string, filename: string | NonSharedBuffer) => void,
413
- ): this;
414
- prependListener(event: "close", listener: () => void): this;
415
- prependListener(event: "error", listener: (error: Error) => void): this;
416
- prependOnceListener(event: string, listener: (...args: any[]) => void): this;
417
- prependOnceListener(
418
- event: "change",
419
- listener: (eventType: string, filename: string | NonSharedBuffer) => void,
420
- ): this;
421
- prependOnceListener(event: "close", listener: () => void): this;
422
- prependOnceListener(event: "error", listener: (error: Error) => void): this;
395
+ }
396
+ interface ReadStreamEventMap extends stream.ReadableEventMap {
397
+ "close": [];
398
+ "data": [chunk: string | NonSharedBuffer];
399
+ "open": [fd: number];
400
+ "ready": [];
423
401
  }
424
402
  /**
425
403
  * Instances of `fs.ReadStream` are created and returned using the {@link createReadStream} function.
426
404
  * @since v0.1.93
427
405
  */
428
- export class ReadStream extends stream.Readable {
406
+ class ReadStream extends stream.Readable {
429
407
  close(callback?: (err?: NodeJS.ErrnoException | null) => void): void;
430
408
  /**
431
409
  * The number of bytes that have been read so far.
@@ -445,19 +423,53 @@ declare module "fs" {
445
423
  * @since v11.2.0, v10.16.0
446
424
  */
447
425
  pending: boolean;
448
- /**
449
- * events.EventEmitter
450
- * 1. open
451
- * 2. close
452
- * 3. ready
453
- */
454
- addListener<K extends keyof ReadStreamEvents>(event: K, listener: ReadStreamEvents[K]): this;
455
- on<K extends keyof ReadStreamEvents>(event: K, listener: ReadStreamEvents[K]): this;
456
- once<K extends keyof ReadStreamEvents>(event: K, listener: ReadStreamEvents[K]): this;
457
- prependListener<K extends keyof ReadStreamEvents>(event: K, listener: ReadStreamEvents[K]): this;
458
- prependOnceListener<K extends keyof ReadStreamEvents>(event: K, listener: ReadStreamEvents[K]): this;
426
+ // #region InternalEventEmitter
427
+ addListener<E extends keyof ReadStreamEventMap>(
428
+ eventName: E,
429
+ listener: (...args: ReadStreamEventMap[E]) => void,
430
+ ): this;
431
+ addListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
432
+ emit<E extends keyof ReadStreamEventMap>(eventName: E, ...args: ReadStreamEventMap[E]): boolean;
433
+ emit(eventName: string | symbol, ...args: any[]): boolean;
434
+ listenerCount<E extends keyof ReadStreamEventMap>(
435
+ eventName: E,
436
+ listener?: (...args: ReadStreamEventMap[E]) => void,
437
+ ): number;
438
+ listenerCount(eventName: string | symbol, listener?: (...args: any[]) => void): number;
439
+ listeners<E extends keyof ReadStreamEventMap>(eventName: E): ((...args: ReadStreamEventMap[E]) => void)[];
440
+ listeners(eventName: string | symbol): ((...args: any[]) => void)[];
441
+ off<E extends keyof ReadStreamEventMap>(eventName: E, listener: (...args: ReadStreamEventMap[E]) => void): this;
442
+ off(eventName: string | symbol, listener: (...args: any[]) => void): this;
443
+ on<E extends keyof ReadStreamEventMap>(eventName: E, listener: (...args: ReadStreamEventMap[E]) => void): this;
444
+ on(eventName: string | symbol, listener: (...args: any[]) => void): this;
445
+ once<E extends keyof ReadStreamEventMap>(
446
+ eventName: E,
447
+ listener: (...args: ReadStreamEventMap[E]) => void,
448
+ ): this;
449
+ once(eventName: string | symbol, listener: (...args: any[]) => void): this;
450
+ prependListener<E extends keyof ReadStreamEventMap>(
451
+ eventName: E,
452
+ listener: (...args: ReadStreamEventMap[E]) => void,
453
+ ): this;
454
+ prependListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
455
+ prependOnceListener<E extends keyof ReadStreamEventMap>(
456
+ eventName: E,
457
+ listener: (...args: ReadStreamEventMap[E]) => void,
458
+ ): this;
459
+ prependOnceListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
460
+ rawListeners<E extends keyof ReadStreamEventMap>(eventName: E): ((...args: ReadStreamEventMap[E]) => void)[];
461
+ rawListeners(eventName: string | symbol): ((...args: any[]) => void)[];
462
+ // eslint-disable-next-line @definitelytyped/no-unnecessary-generics
463
+ removeAllListeners<E extends keyof ReadStreamEventMap>(eventName?: E): this;
464
+ removeAllListeners(eventName?: string | symbol): this;
465
+ removeListener<E extends keyof ReadStreamEventMap>(
466
+ eventName: E,
467
+ listener: (...args: ReadStreamEventMap[E]) => void,
468
+ ): this;
469
+ removeListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
470
+ // #endregion
459
471
  }
460
- export interface Utf8StreamOptions {
472
+ interface Utf8StreamOptions {
461
473
  /**
462
474
  * Appends writes to dest file instead of truncating it.
463
475
  * @default true
@@ -533,6 +545,15 @@ declare module "fs" {
533
545
  */
534
546
  sync?: boolean | undefined;
535
547
  }
548
+ interface Utf8StreamEventMap {
549
+ "close": [];
550
+ "drain": [];
551
+ "drop": [data: string | Buffer];
552
+ "error": [error: Error];
553
+ "finish": [];
554
+ "ready": [];
555
+ "write": [n: number];
556
+ }
536
557
  /**
537
558
  * An optimized UTF-8 stream writer that allows for flushing all the internal
538
559
  * buffering on demand. It handles `EAGAIN` errors correctly, allowing for
@@ -540,7 +561,7 @@ declare module "fs" {
540
561
  * @since v24.6.0
541
562
  * @experimental
542
563
  */
543
- export class Utf8Stream extends EventEmitter {
564
+ class Utf8Stream implements EventEmitter {
544
565
  constructor(options: Utf8StreamOptions);
545
566
  /**
546
567
  * Whether the stream is appending to the file or truncating it.
@@ -634,95 +655,18 @@ declare module "fs" {
634
655
  * Calls `utf8Stream.destroy()`.
635
656
  */
636
657
  [Symbol.dispose](): void;
637
- /**
638
- * events.EventEmitter
639
- * 1. change
640
- * 2. close
641
- * 3. error
642
- */
643
- addListener(event: "close", listener: () => void): this;
644
- addListener(event: "drain", listener: () => void): this;
645
- addListener(event: "drop", listener: (data: string | Buffer) => void): this;
646
- addListener(event: "error", listener: (error: Error) => void): this;
647
- addListener(event: "finish", listener: () => void): this;
648
- addListener(event: "ready", listener: () => void): this;
649
- addListener(event: "write", listener: (n: number) => void): this;
650
- addListener(event: string, listener: (...args: any[]) => void): this;
651
- on(event: "close", listener: () => void): this;
652
- on(event: "drain", listener: () => void): this;
653
- on(event: "drop", listener: (data: string | Buffer) => void): this;
654
- on(event: "error", listener: (error: Error) => void): this;
655
- on(event: "finish", listener: () => void): this;
656
- on(event: "ready", listener: () => void): this;
657
- on(event: "write", listener: (n: number) => void): this;
658
- on(event: string, listener: (...args: any[]) => void): this;
659
- once(event: "close", listener: () => void): this;
660
- once(event: "drain", listener: () => void): this;
661
- once(event: "drop", listener: (data: string | Buffer) => void): this;
662
- once(event: "error", listener: (error: Error) => void): this;
663
- once(event: "finish", listener: () => void): this;
664
- once(event: "ready", listener: () => void): this;
665
- once(event: "write", listener: (n: number) => void): this;
666
- once(event: string, listener: (...args: any[]) => void): this;
667
- prependListener(event: "close", listener: () => void): this;
668
- prependListener(event: "drain", listener: () => void): this;
669
- prependListener(event: "drop", listener: (data: string | Buffer) => void): this;
670
- prependListener(event: "error", listener: (error: Error) => void): this;
671
- prependListener(event: "finish", listener: () => void): this;
672
- prependListener(event: "ready", listener: () => void): this;
673
- prependListener(event: "write", listener: (n: number) => void): this;
674
- prependListener(event: string, listener: (...args: any[]) => void): this;
675
- prependOnceListener(event: "close", listener: () => void): this;
676
- prependOnceListener(event: "drain", listener: () => void): this;
677
- prependOnceListener(event: "drop", listener: (data: string | Buffer) => void): this;
678
- prependOnceListener(event: "error", listener: (error: Error) => void): this;
679
- prependOnceListener(event: "finish", listener: () => void): this;
680
- prependOnceListener(event: "ready", listener: () => void): this;
681
- prependOnceListener(event: "write", listener: (n: number) => void): this;
682
- prependOnceListener(event: string, listener: (...args: any[]) => void): this;
683
658
  }
684
-
685
- /**
686
- * The Keys are events of the ReadStream and the values are the functions that are called when the event is emitted.
687
- */
688
- type ReadStreamEvents = {
689
- close: () => void;
690
- data: (chunk: Buffer | string) => void;
691
- end: () => void;
692
- error: (err: Error) => void;
693
- open: (fd: number) => void;
694
- pause: () => void;
695
- readable: () => void;
696
- ready: () => void;
697
- resume: () => void;
698
- } & CustomEvents;
699
-
700
- /**
701
- * string & {} allows to allow any kind of strings for the event
702
- * but still allows to have auto completion for the normal events.
703
- */
704
- type CustomEvents = { [Key in string & {} | symbol]: (...args: any[]) => void };
705
-
706
- /**
707
- * The Keys are events of the WriteStream and the values are the functions that are called when the event is emitted.
708
- */
709
- type WriteStreamEvents = {
710
- close: () => void;
711
- drain: () => void;
712
- error: (err: Error) => void;
713
- finish: () => void;
714
- open: (fd: number) => void;
715
- pipe: (src: stream.Readable) => void;
716
- ready: () => void;
717
- unpipe: (src: stream.Readable) => void;
718
- } & CustomEvents;
659
+ interface Utf8Stream extends InternalEventEmitter<Utf8StreamEventMap> {}
660
+ interface WriteStreamEventMap extends stream.WritableEventMap {
661
+ "close": [];
662
+ "open": [fd: number];
663
+ "ready": [];
664
+ }
719
665
  /**
720
- * * Extends `stream.Writable`
721
- *
722
666
  * Instances of `fs.WriteStream` are created and returned using the {@link createWriteStream} function.
723
667
  * @since v0.1.93
724
668
  */
725
- export class WriteStream extends stream.Writable {
669
+ class WriteStream extends stream.Writable {
726
670
  /**
727
671
  * Closes `writeStream`. Optionally accepts a
728
672
  * callback that will be executed once the `writeStream`is closed.
@@ -748,17 +692,57 @@ declare module "fs" {
748
692
  * @since v11.2.0
749
693
  */
750
694
  pending: boolean;
751
- /**
752
- * events.EventEmitter
753
- * 1. open
754
- * 2. close
755
- * 3. ready
756
- */
757
- addListener<K extends keyof WriteStreamEvents>(event: K, listener: WriteStreamEvents[K]): this;
758
- on<K extends keyof WriteStreamEvents>(event: K, listener: WriteStreamEvents[K]): this;
759
- once<K extends keyof WriteStreamEvents>(event: K, listener: WriteStreamEvents[K]): this;
760
- prependListener<K extends keyof WriteStreamEvents>(event: K, listener: WriteStreamEvents[K]): this;
761
- prependOnceListener<K extends keyof WriteStreamEvents>(event: K, listener: WriteStreamEvents[K]): this;
695
+ // #region InternalEventEmitter
696
+ addListener<E extends keyof WriteStreamEventMap>(
697
+ eventName: E,
698
+ listener: (...args: WriteStreamEventMap[E]) => void,
699
+ ): this;
700
+ addListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
701
+ emit<E extends keyof WriteStreamEventMap>(eventName: E, ...args: WriteStreamEventMap[E]): boolean;
702
+ emit(eventName: string | symbol, ...args: any[]): boolean;
703
+ listenerCount<E extends keyof WriteStreamEventMap>(
704
+ eventName: E,
705
+ listener?: (...args: WriteStreamEventMap[E]) => void,
706
+ ): number;
707
+ listenerCount(eventName: string | symbol, listener?: (...args: any[]) => void): number;
708
+ listeners<E extends keyof WriteStreamEventMap>(eventName: E): ((...args: WriteStreamEventMap[E]) => void)[];
709
+ listeners(eventName: string | symbol): ((...args: any[]) => void)[];
710
+ off<E extends keyof WriteStreamEventMap>(
711
+ eventName: E,
712
+ listener: (...args: WriteStreamEventMap[E]) => void,
713
+ ): this;
714
+ off(eventName: string | symbol, listener: (...args: any[]) => void): this;
715
+ on<E extends keyof WriteStreamEventMap>(
716
+ eventName: E,
717
+ listener: (...args: WriteStreamEventMap[E]) => void,
718
+ ): this;
719
+ on(eventName: string | symbol, listener: (...args: any[]) => void): this;
720
+ once<E extends keyof WriteStreamEventMap>(
721
+ eventName: E,
722
+ listener: (...args: WriteStreamEventMap[E]) => void,
723
+ ): this;
724
+ once(eventName: string | symbol, listener: (...args: any[]) => void): this;
725
+ prependListener<E extends keyof WriteStreamEventMap>(
726
+ eventName: E,
727
+ listener: (...args: WriteStreamEventMap[E]) => void,
728
+ ): this;
729
+ prependListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
730
+ prependOnceListener<E extends keyof WriteStreamEventMap>(
731
+ eventName: E,
732
+ listener: (...args: WriteStreamEventMap[E]) => void,
733
+ ): this;
734
+ prependOnceListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
735
+ rawListeners<E extends keyof WriteStreamEventMap>(eventName: E): ((...args: WriteStreamEventMap[E]) => void)[];
736
+ rawListeners(eventName: string | symbol): ((...args: any[]) => void)[];
737
+ // eslint-disable-next-line @definitelytyped/no-unnecessary-generics
738
+ removeAllListeners<E extends keyof WriteStreamEventMap>(eventName?: E): this;
739
+ removeAllListeners(eventName?: string | symbol): this;
740
+ removeListener<E extends keyof WriteStreamEventMap>(
741
+ eventName: E,
742
+ listener: (...args: WriteStreamEventMap[E]) => void,
743
+ ): this;
744
+ removeListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
745
+ // #endregion
762
746
  }
763
747
  /**
764
748
  * Asynchronously rename file at `oldPath` to the pathname provided
@@ -779,8 +763,8 @@ declare module "fs" {
779
763
  * ```
780
764
  * @since v0.0.2
781
765
  */
782
- export function rename(oldPath: PathLike, newPath: PathLike, callback: NoParamCallback): void;
783
- export namespace rename {
766
+ function rename(oldPath: PathLike, newPath: PathLike, callback: NoParamCallback): void;
767
+ namespace rename {
784
768
  /**
785
769
  * Asynchronous rename(2) - Change the name or location of a file or directory.
786
770
  * @param oldPath A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -796,7 +780,7 @@ declare module "fs" {
796
780
  * See the POSIX [`rename(2)`](http://man7.org/linux/man-pages/man2/rename.2.html) documentation for more details.
797
781
  * @since v0.1.21
798
782
  */
799
- export function renameSync(oldPath: PathLike, newPath: PathLike): void;
783
+ function renameSync(oldPath: PathLike, newPath: PathLike): void;
800
784
  /**
801
785
  * Truncates the file. No arguments other than a possible exception are
802
786
  * given to the completion callback. A file descriptor can also be passed as the
@@ -818,13 +802,13 @@ declare module "fs" {
818
802
  * @since v0.8.6
819
803
  * @param [len=0]
820
804
  */
821
- export function truncate(path: PathLike, len: number | undefined, callback: NoParamCallback): void;
805
+ function truncate(path: PathLike, len: number | undefined, callback: NoParamCallback): void;
822
806
  /**
823
807
  * Asynchronous truncate(2) - Truncate a file to a specified length.
824
808
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
825
809
  */
826
- export function truncate(path: PathLike, callback: NoParamCallback): void;
827
- export namespace truncate {
810
+ function truncate(path: PathLike, callback: NoParamCallback): void;
811
+ namespace truncate {
828
812
  /**
829
813
  * Asynchronous truncate(2) - Truncate a file to a specified length.
830
814
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -841,7 +825,7 @@ declare module "fs" {
841
825
  * @since v0.8.6
842
826
  * @param [len=0]
843
827
  */
844
- export function truncateSync(path: PathLike, len?: number): void;
828
+ function truncateSync(path: PathLike, len?: number): void;
845
829
  /**
846
830
  * Truncates the file descriptor. No arguments other than a possible exception are
847
831
  * given to the completion callback.
@@ -885,13 +869,13 @@ declare module "fs" {
885
869
  * @since v0.8.6
886
870
  * @param [len=0]
887
871
  */
888
- export function ftruncate(fd: number, len: number | undefined, callback: NoParamCallback): void;
872
+ function ftruncate(fd: number, len: number | undefined, callback: NoParamCallback): void;
889
873
  /**
890
874
  * Asynchronous ftruncate(2) - Truncate a file to a specified length.
891
875
  * @param fd A file descriptor.
892
876
  */
893
- export function ftruncate(fd: number, callback: NoParamCallback): void;
894
- export namespace ftruncate {
877
+ function ftruncate(fd: number, callback: NoParamCallback): void;
878
+ namespace ftruncate {
895
879
  /**
896
880
  * Asynchronous ftruncate(2) - Truncate a file to a specified length.
897
881
  * @param fd A file descriptor.
@@ -907,7 +891,7 @@ declare module "fs" {
907
891
  * @since v0.8.6
908
892
  * @param [len=0]
909
893
  */
910
- export function ftruncateSync(fd: number, len?: number): void;
894
+ function ftruncateSync(fd: number, len?: number): void;
911
895
  /**
912
896
  * Asynchronously changes owner and group of a file. No arguments other than a
913
897
  * possible exception are given to the completion callback.
@@ -915,8 +899,8 @@ declare module "fs" {
915
899
  * See the POSIX [`chown(2)`](http://man7.org/linux/man-pages/man2/chown.2.html) documentation for more detail.
916
900
  * @since v0.1.97
917
901
  */
918
- export function chown(path: PathLike, uid: number, gid: number, callback: NoParamCallback): void;
919
- export namespace chown {
902
+ function chown(path: PathLike, uid: number, gid: number, callback: NoParamCallback): void;
903
+ namespace chown {
920
904
  /**
921
905
  * Asynchronous chown(2) - Change ownership of a file.
922
906
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -930,7 +914,7 @@ declare module "fs" {
930
914
  * See the POSIX [`chown(2)`](http://man7.org/linux/man-pages/man2/chown.2.html) documentation for more detail.
931
915
  * @since v0.1.97
932
916
  */
933
- export function chownSync(path: PathLike, uid: number, gid: number): void;
917
+ function chownSync(path: PathLike, uid: number, gid: number): void;
934
918
  /**
935
919
  * Sets the owner of the file. No arguments other than a possible exception are
936
920
  * given to the completion callback.
@@ -938,8 +922,8 @@ declare module "fs" {
938
922
  * See the POSIX [`fchown(2)`](http://man7.org/linux/man-pages/man2/fchown.2.html) documentation for more detail.
939
923
  * @since v0.4.7
940
924
  */
941
- export function fchown(fd: number, uid: number, gid: number, callback: NoParamCallback): void;
942
- export namespace fchown {
925
+ function fchown(fd: number, uid: number, gid: number, callback: NoParamCallback): void;
926
+ namespace fchown {
943
927
  /**
944
928
  * Asynchronous fchown(2) - Change ownership of a file.
945
929
  * @param fd A file descriptor.
@@ -954,15 +938,15 @@ declare module "fs" {
954
938
  * @param uid The file's new owner's user id.
955
939
  * @param gid The file's new group's group id.
956
940
  */
957
- export function fchownSync(fd: number, uid: number, gid: number): void;
941
+ function fchownSync(fd: number, uid: number, gid: number): void;
958
942
  /**
959
943
  * Set the owner of the symbolic link. No arguments other than a possible
960
944
  * exception are given to the completion callback.
961
945
  *
962
946
  * See the POSIX [`lchown(2)`](http://man7.org/linux/man-pages/man2/lchown.2.html) documentation for more detail.
963
947
  */
964
- export function lchown(path: PathLike, uid: number, gid: number, callback: NoParamCallback): void;
965
- export namespace lchown {
948
+ function lchown(path: PathLike, uid: number, gid: number, callback: NoParamCallback): void;
949
+ namespace lchown {
966
950
  /**
967
951
  * Asynchronous lchown(2) - Change ownership of a file. Does not dereference symbolic links.
968
952
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -976,7 +960,7 @@ declare module "fs" {
976
960
  * @param uid The file's new owner's user id.
977
961
  * @param gid The file's new group's group id.
978
962
  */
979
- export function lchownSync(path: PathLike, uid: number, gid: number): void;
963
+ function lchownSync(path: PathLike, uid: number, gid: number): void;
980
964
  /**
981
965
  * Changes the access and modification times of a file in the same way as {@link utimes}, with the difference that if the path refers to a symbolic
982
966
  * link, then the link is not dereferenced: instead, the timestamps of the
@@ -986,8 +970,8 @@ declare module "fs" {
986
970
  * callback.
987
971
  * @since v14.5.0, v12.19.0
988
972
  */
989
- export function lutimes(path: PathLike, atime: TimeLike, mtime: TimeLike, callback: NoParamCallback): void;
990
- export namespace lutimes {
973
+ function lutimes(path: PathLike, atime: TimeLike, mtime: TimeLike, callback: NoParamCallback): void;
974
+ namespace lutimes {
991
975
  /**
992
976
  * Changes the access and modification times of a file in the same way as `fsPromises.utimes()`,
993
977
  * with the difference that if the path refers to a symbolic link, then the link is not
@@ -1004,7 +988,7 @@ declare module "fs" {
1004
988
  * the operation fails. This is the synchronous version of {@link lutimes}.
1005
989
  * @since v14.5.0, v12.19.0
1006
990
  */
1007
- export function lutimesSync(path: PathLike, atime: TimeLike, mtime: TimeLike): void;
991
+ function lutimesSync(path: PathLike, atime: TimeLike, mtime: TimeLike): void;
1008
992
  /**
1009
993
  * Asynchronously changes the permissions of a file. No arguments other than a
1010
994
  * possible exception are given to the completion callback.
@@ -1021,8 +1005,8 @@ declare module "fs" {
1021
1005
  * ```
1022
1006
  * @since v0.1.30
1023
1007
  */
1024
- export function chmod(path: PathLike, mode: Mode, callback: NoParamCallback): void;
1025
- export namespace chmod {
1008
+ function chmod(path: PathLike, mode: Mode, callback: NoParamCallback): void;
1009
+ namespace chmod {
1026
1010
  /**
1027
1011
  * Asynchronous chmod(2) - Change permissions of a file.
1028
1012
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -1037,7 +1021,7 @@ declare module "fs" {
1037
1021
  * See the POSIX [`chmod(2)`](http://man7.org/linux/man-pages/man2/chmod.2.html) documentation for more detail.
1038
1022
  * @since v0.6.7
1039
1023
  */
1040
- export function chmodSync(path: PathLike, mode: Mode): void;
1024
+ function chmodSync(path: PathLike, mode: Mode): void;
1041
1025
  /**
1042
1026
  * Sets the permissions on the file. No arguments other than a possible exception
1043
1027
  * are given to the completion callback.
@@ -1045,8 +1029,8 @@ declare module "fs" {
1045
1029
  * See the POSIX [`fchmod(2)`](http://man7.org/linux/man-pages/man2/fchmod.2.html) documentation for more detail.
1046
1030
  * @since v0.4.7
1047
1031
  */
1048
- export function fchmod(fd: number, mode: Mode, callback: NoParamCallback): void;
1049
- export namespace fchmod {
1032
+ function fchmod(fd: number, mode: Mode, callback: NoParamCallback): void;
1033
+ namespace fchmod {
1050
1034
  /**
1051
1035
  * Asynchronous fchmod(2) - Change permissions of a file.
1052
1036
  * @param fd A file descriptor.
@@ -1060,7 +1044,7 @@ declare module "fs" {
1060
1044
  * See the POSIX [`fchmod(2)`](http://man7.org/linux/man-pages/man2/fchmod.2.html) documentation for more detail.
1061
1045
  * @since v0.4.7
1062
1046
  */
1063
- export function fchmodSync(fd: number, mode: Mode): void;
1047
+ function fchmodSync(fd: number, mode: Mode): void;
1064
1048
  /**
1065
1049
  * Changes the permissions on a symbolic link. No arguments other than a possible
1066
1050
  * exception are given to the completion callback.
@@ -1070,9 +1054,9 @@ declare module "fs" {
1070
1054
  * See the POSIX [`lchmod(2)`](https://www.freebsd.org/cgi/man.cgi?query=lchmod&sektion=2) documentation for more detail.
1071
1055
  * @deprecated Since v0.4.7
1072
1056
  */
1073
- export function lchmod(path: PathLike, mode: Mode, callback: NoParamCallback): void;
1057
+ function lchmod(path: PathLike, mode: Mode, callback: NoParamCallback): void;
1074
1058
  /** @deprecated */
1075
- export namespace lchmod {
1059
+ namespace lchmod {
1076
1060
  /**
1077
1061
  * Asynchronous lchmod(2) - Change permissions of a file. Does not dereference symbolic links.
1078
1062
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -1088,7 +1072,7 @@ declare module "fs" {
1088
1072
  * See the POSIX [`lchmod(2)`](https://www.freebsd.org/cgi/man.cgi?query=lchmod&sektion=2) documentation for more detail.
1089
1073
  * @deprecated Since v0.4.7
1090
1074
  */
1091
- export function lchmodSync(path: PathLike, mode: Mode): void;
1075
+ function lchmodSync(path: PathLike, mode: Mode): void;
1092
1076
  /**
1093
1077
  * Asynchronous [`stat(2)`](http://man7.org/linux/man-pages/man2/stat.2.html). The callback gets two arguments `(err, stats)` where`stats` is an `fs.Stats` object.
1094
1078
  *
@@ -1174,8 +1158,8 @@ declare module "fs" {
1174
1158
  * ```
1175
1159
  * @since v0.0.2
1176
1160
  */
1177
- export function stat(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
1178
- export function stat(
1161
+ function stat(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
1162
+ function stat(
1179
1163
  path: PathLike,
1180
1164
  options:
1181
1165
  | (StatOptions & {
@@ -1184,19 +1168,19 @@ declare module "fs" {
1184
1168
  | undefined,
1185
1169
  callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void,
1186
1170
  ): void;
1187
- export function stat(
1171
+ function stat(
1188
1172
  path: PathLike,
1189
1173
  options: StatOptions & {
1190
1174
  bigint: true;
1191
1175
  },
1192
1176
  callback: (err: NodeJS.ErrnoException | null, stats: BigIntStats) => void,
1193
1177
  ): void;
1194
- export function stat(
1178
+ function stat(
1195
1179
  path: PathLike,
1196
1180
  options: StatOptions | undefined,
1197
1181
  callback: (err: NodeJS.ErrnoException | null, stats: Stats | BigIntStats) => void,
1198
1182
  ): void;
1199
- export namespace stat {
1183
+ namespace stat {
1200
1184
  /**
1201
1185
  * Asynchronous stat(2) - Get file status.
1202
1186
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -1215,7 +1199,7 @@ declare module "fs" {
1215
1199
  ): Promise<BigIntStats>;
1216
1200
  function __promisify__(path: PathLike, options?: StatOptions): Promise<Stats | BigIntStats>;
1217
1201
  }
1218
- export interface StatSyncFn extends Function {
1202
+ interface StatSyncFn extends Function {
1219
1203
  (path: PathLike, options?: undefined): Stats;
1220
1204
  (
1221
1205
  path: PathLike,
@@ -1256,15 +1240,15 @@ declare module "fs" {
1256
1240
  * Synchronous stat(2) - Get file status.
1257
1241
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1258
1242
  */
1259
- export const statSync: StatSyncFn;
1243
+ const statSync: StatSyncFn;
1260
1244
  /**
1261
1245
  * Invokes the callback with the `fs.Stats` for the file descriptor.
1262
1246
  *
1263
1247
  * See the POSIX [`fstat(2)`](http://man7.org/linux/man-pages/man2/fstat.2.html) documentation for more detail.
1264
1248
  * @since v0.1.95
1265
1249
  */
1266
- export function fstat(fd: number, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
1267
- export function fstat(
1250
+ function fstat(fd: number, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
1251
+ function fstat(
1268
1252
  fd: number,
1269
1253
  options:
1270
1254
  | (StatOptions & {
@@ -1273,19 +1257,19 @@ declare module "fs" {
1273
1257
  | undefined,
1274
1258
  callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void,
1275
1259
  ): void;
1276
- export function fstat(
1260
+ function fstat(
1277
1261
  fd: number,
1278
1262
  options: StatOptions & {
1279
1263
  bigint: true;
1280
1264
  },
1281
1265
  callback: (err: NodeJS.ErrnoException | null, stats: BigIntStats) => void,
1282
1266
  ): void;
1283
- export function fstat(
1267
+ function fstat(
1284
1268
  fd: number,
1285
1269
  options: StatOptions | undefined,
1286
1270
  callback: (err: NodeJS.ErrnoException | null, stats: Stats | BigIntStats) => void,
1287
1271
  ): void;
1288
- export namespace fstat {
1272
+ namespace fstat {
1289
1273
  /**
1290
1274
  * Asynchronous fstat(2) - Get file status.
1291
1275
  * @param fd A file descriptor.
@@ -1310,19 +1294,19 @@ declare module "fs" {
1310
1294
  * See the POSIX [`fstat(2)`](http://man7.org/linux/man-pages/man2/fstat.2.html) documentation for more detail.
1311
1295
  * @since v0.1.95
1312
1296
  */
1313
- export function fstatSync(
1297
+ function fstatSync(
1314
1298
  fd: number,
1315
1299
  options?: StatOptions & {
1316
1300
  bigint?: false | undefined;
1317
1301
  },
1318
1302
  ): Stats;
1319
- export function fstatSync(
1303
+ function fstatSync(
1320
1304
  fd: number,
1321
1305
  options: StatOptions & {
1322
1306
  bigint: true;
1323
1307
  },
1324
1308
  ): BigIntStats;
1325
- export function fstatSync(fd: number, options?: StatOptions): Stats | BigIntStats;
1309
+ function fstatSync(fd: number, options?: StatOptions): Stats | BigIntStats;
1326
1310
  /**
1327
1311
  * Retrieves the `fs.Stats` for the symbolic link referred to by the path.
1328
1312
  * The callback gets two arguments `(err, stats)` where `stats` is a `fs.Stats` object. `lstat()` is identical to `stat()`, except that if `path` is a symbolic
@@ -1331,8 +1315,8 @@ declare module "fs" {
1331
1315
  * See the POSIX [`lstat(2)`](http://man7.org/linux/man-pages/man2/lstat.2.html) documentation for more details.
1332
1316
  * @since v0.1.30
1333
1317
  */
1334
- export function lstat(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
1335
- export function lstat(
1318
+ function lstat(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
1319
+ function lstat(
1336
1320
  path: PathLike,
1337
1321
  options:
1338
1322
  | (StatOptions & {
@@ -1341,19 +1325,19 @@ declare module "fs" {
1341
1325
  | undefined,
1342
1326
  callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void,
1343
1327
  ): void;
1344
- export function lstat(
1328
+ function lstat(
1345
1329
  path: PathLike,
1346
1330
  options: StatOptions & {
1347
1331
  bigint: true;
1348
1332
  },
1349
1333
  callback: (err: NodeJS.ErrnoException | null, stats: BigIntStats) => void,
1350
1334
  ): void;
1351
- export function lstat(
1335
+ function lstat(
1352
1336
  path: PathLike,
1353
1337
  options: StatOptions | undefined,
1354
1338
  callback: (err: NodeJS.ErrnoException | null, stats: Stats | BigIntStats) => void,
1355
1339
  ): void;
1356
- export namespace lstat {
1340
+ namespace lstat {
1357
1341
  /**
1358
1342
  * Asynchronous lstat(2) - Get file status. Does not dereference symbolic links.
1359
1343
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -1380,8 +1364,8 @@ declare module "fs" {
1380
1364
  * @since v19.6.0, v18.15.0
1381
1365
  * @param path A path to an existing file or directory on the file system to be queried.
1382
1366
  */
1383
- export function statfs(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: StatsFs) => void): void;
1384
- export function statfs(
1367
+ function statfs(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: StatsFs) => void): void;
1368
+ function statfs(
1385
1369
  path: PathLike,
1386
1370
  options:
1387
1371
  | (StatFsOptions & {
@@ -1390,19 +1374,19 @@ declare module "fs" {
1390
1374
  | undefined,
1391
1375
  callback: (err: NodeJS.ErrnoException | null, stats: StatsFs) => void,
1392
1376
  ): void;
1393
- export function statfs(
1377
+ function statfs(
1394
1378
  path: PathLike,
1395
1379
  options: StatFsOptions & {
1396
1380
  bigint: true;
1397
1381
  },
1398
1382
  callback: (err: NodeJS.ErrnoException | null, stats: BigIntStatsFs) => void,
1399
1383
  ): void;
1400
- export function statfs(
1384
+ function statfs(
1401
1385
  path: PathLike,
1402
1386
  options: StatFsOptions | undefined,
1403
1387
  callback: (err: NodeJS.ErrnoException | null, stats: StatsFs | BigIntStatsFs) => void,
1404
1388
  ): void;
1405
- export namespace statfs {
1389
+ namespace statfs {
1406
1390
  /**
1407
1391
  * 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.
1408
1392
  * @param path A path to an existing file or directory on the file system to be queried.
@@ -1429,32 +1413,32 @@ declare module "fs" {
1429
1413
  * @since v19.6.0, v18.15.0
1430
1414
  * @param path A path to an existing file or directory on the file system to be queried.
1431
1415
  */
1432
- export function statfsSync(
1416
+ function statfsSync(
1433
1417
  path: PathLike,
1434
1418
  options?: StatFsOptions & {
1435
1419
  bigint?: false | undefined;
1436
1420
  },
1437
1421
  ): StatsFs;
1438
- export function statfsSync(
1422
+ function statfsSync(
1439
1423
  path: PathLike,
1440
1424
  options: StatFsOptions & {
1441
1425
  bigint: true;
1442
1426
  },
1443
1427
  ): BigIntStatsFs;
1444
- export function statfsSync(path: PathLike, options?: StatFsOptions): StatsFs | BigIntStatsFs;
1428
+ function statfsSync(path: PathLike, options?: StatFsOptions): StatsFs | BigIntStatsFs;
1445
1429
  /**
1446
1430
  * Synchronous lstat(2) - Get file status. Does not dereference symbolic links.
1447
1431
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1448
1432
  */
1449
- export const lstatSync: StatSyncFn;
1433
+ const lstatSync: StatSyncFn;
1450
1434
  /**
1451
1435
  * 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. No arguments other than
1452
1436
  * a possible
1453
1437
  * exception are given to the completion callback.
1454
1438
  * @since v0.1.31
1455
1439
  */
1456
- export function link(existingPath: PathLike, newPath: PathLike, callback: NoParamCallback): void;
1457
- export namespace link {
1440
+ function link(existingPath: PathLike, newPath: PathLike, callback: NoParamCallback): void;
1441
+ namespace link {
1458
1442
  /**
1459
1443
  * Asynchronous link(2) - Create a new link (also known as a hard link) to an existing file.
1460
1444
  * @param existingPath A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -1466,7 +1450,7 @@ declare module "fs" {
1466
1450
  * 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. Returns `undefined`.
1467
1451
  * @since v0.1.31
1468
1452
  */
1469
- export function linkSync(existingPath: PathLike, newPath: PathLike): void;
1453
+ function linkSync(existingPath: PathLike, newPath: PathLike): void;
1470
1454
  /**
1471
1455
  * Creates the link called `path` pointing to `target`. No arguments other than a
1472
1456
  * possible exception are given to the completion callback.
@@ -1500,7 +1484,7 @@ declare module "fs" {
1500
1484
  * @since v0.1.31
1501
1485
  * @param [type='null']
1502
1486
  */
1503
- export function symlink(
1487
+ function symlink(
1504
1488
  target: PathLike,
1505
1489
  path: PathLike,
1506
1490
  type: symlink.Type | undefined | null,
@@ -1511,8 +1495,8 @@ declare module "fs" {
1511
1495
  * @param target A path to an existing file. If a URL is provided, it must use the `file:` protocol.
1512
1496
  * @param path A path to the new symlink. If a URL is provided, it must use the `file:` protocol.
1513
1497
  */
1514
- export function symlink(target: PathLike, path: PathLike, callback: NoParamCallback): void;
1515
- export namespace symlink {
1498
+ function symlink(target: PathLike, path: PathLike, callback: NoParamCallback): void;
1499
+ namespace symlink {
1516
1500
  /**
1517
1501
  * Asynchronous symlink(2) - Create a new symbolic link to an existing file.
1518
1502
  * @param target A path to an existing file. If a URL is provided, it must use the `file:` protocol.
@@ -1531,7 +1515,7 @@ declare module "fs" {
1531
1515
  * @since v0.1.31
1532
1516
  * @param [type='null']
1533
1517
  */
1534
- export function symlinkSync(target: PathLike, path: PathLike, type?: symlink.Type | null): void;
1518
+ function symlinkSync(target: PathLike, path: PathLike, type?: symlink.Type | null): void;
1535
1519
  /**
1536
1520
  * Reads the contents of the symbolic link referred to by `path`. The callback gets
1537
1521
  * two arguments `(err, linkString)`.
@@ -1544,7 +1528,7 @@ declare module "fs" {
1544
1528
  * the link path returned will be passed as a `Buffer` object.
1545
1529
  * @since v0.1.31
1546
1530
  */
1547
- export function readlink(
1531
+ function readlink(
1548
1532
  path: PathLike,
1549
1533
  options: EncodingOption,
1550
1534
  callback: (err: NodeJS.ErrnoException | null, linkString: string) => void,
@@ -1554,7 +1538,7 @@ declare module "fs" {
1554
1538
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1555
1539
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1556
1540
  */
1557
- export function readlink(
1541
+ function readlink(
1558
1542
  path: PathLike,
1559
1543
  options: BufferEncodingOption,
1560
1544
  callback: (err: NodeJS.ErrnoException | null, linkString: NonSharedBuffer) => void,
@@ -1564,7 +1548,7 @@ declare module "fs" {
1564
1548
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1565
1549
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1566
1550
  */
1567
- export function readlink(
1551
+ function readlink(
1568
1552
  path: PathLike,
1569
1553
  options: EncodingOption,
1570
1554
  callback: (err: NodeJS.ErrnoException | null, linkString: string | NonSharedBuffer) => void,
@@ -1573,11 +1557,11 @@ declare module "fs" {
1573
1557
  * Asynchronous readlink(2) - read value of a symbolic link.
1574
1558
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1575
1559
  */
1576
- export function readlink(
1560
+ function readlink(
1577
1561
  path: PathLike,
1578
1562
  callback: (err: NodeJS.ErrnoException | null, linkString: string) => void,
1579
1563
  ): void;
1580
- export namespace readlink {
1564
+ namespace readlink {
1581
1565
  /**
1582
1566
  * Asynchronous readlink(2) - read value of a symbolic link.
1583
1567
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -1608,19 +1592,19 @@ declare module "fs" {
1608
1592
  * the link path returned will be passed as a `Buffer` object.
1609
1593
  * @since v0.1.31
1610
1594
  */
1611
- export function readlinkSync(path: PathLike, options?: EncodingOption): string;
1595
+ function readlinkSync(path: PathLike, options?: EncodingOption): string;
1612
1596
  /**
1613
1597
  * Synchronous readlink(2) - read value of a symbolic link.
1614
1598
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1615
1599
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1616
1600
  */
1617
- export function readlinkSync(path: PathLike, options: BufferEncodingOption): NonSharedBuffer;
1601
+ function readlinkSync(path: PathLike, options: BufferEncodingOption): NonSharedBuffer;
1618
1602
  /**
1619
1603
  * Synchronous readlink(2) - read value of a symbolic link.
1620
1604
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1621
1605
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1622
1606
  */
1623
- export function readlinkSync(path: PathLike, options?: EncodingOption): string | NonSharedBuffer;
1607
+ function readlinkSync(path: PathLike, options?: EncodingOption): string | NonSharedBuffer;
1624
1608
  /**
1625
1609
  * Asynchronously computes the canonical pathname by resolving `.`, `..`, and
1626
1610
  * symbolic links.
@@ -1647,7 +1631,7 @@ declare module "fs" {
1647
1631
  * dependent name for that object.
1648
1632
  * @since v0.1.31
1649
1633
  */
1650
- export function realpath(
1634
+ function realpath(
1651
1635
  path: PathLike,
1652
1636
  options: EncodingOption,
1653
1637
  callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void,
@@ -1657,7 +1641,7 @@ declare module "fs" {
1657
1641
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1658
1642
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1659
1643
  */
1660
- export function realpath(
1644
+ function realpath(
1661
1645
  path: PathLike,
1662
1646
  options: BufferEncodingOption,
1663
1647
  callback: (err: NodeJS.ErrnoException | null, resolvedPath: NonSharedBuffer) => void,
@@ -1667,7 +1651,7 @@ declare module "fs" {
1667
1651
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1668
1652
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1669
1653
  */
1670
- export function realpath(
1654
+ function realpath(
1671
1655
  path: PathLike,
1672
1656
  options: EncodingOption,
1673
1657
  callback: (err: NodeJS.ErrnoException | null, resolvedPath: string | NonSharedBuffer) => void,
@@ -1676,11 +1660,11 @@ declare module "fs" {
1676
1660
  * Asynchronous realpath(3) - return the canonicalized absolute pathname.
1677
1661
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1678
1662
  */
1679
- export function realpath(
1663
+ function realpath(
1680
1664
  path: PathLike,
1681
1665
  callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void,
1682
1666
  ): void;
1683
- export namespace realpath {
1667
+ namespace realpath {
1684
1668
  /**
1685
1669
  * Asynchronous realpath(3) - return the canonicalized absolute pathname.
1686
1670
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -1743,20 +1727,20 @@ declare module "fs" {
1743
1727
  * this API: {@link realpath}.
1744
1728
  * @since v0.1.31
1745
1729
  */
1746
- export function realpathSync(path: PathLike, options?: EncodingOption): string;
1730
+ function realpathSync(path: PathLike, options?: EncodingOption): string;
1747
1731
  /**
1748
1732
  * Synchronous realpath(3) - return the canonicalized absolute pathname.
1749
1733
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1750
1734
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1751
1735
  */
1752
- export function realpathSync(path: PathLike, options: BufferEncodingOption): NonSharedBuffer;
1736
+ function realpathSync(path: PathLike, options: BufferEncodingOption): NonSharedBuffer;
1753
1737
  /**
1754
1738
  * Synchronous realpath(3) - return the canonicalized absolute pathname.
1755
1739
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1756
1740
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1757
1741
  */
1758
- export function realpathSync(path: PathLike, options?: EncodingOption): string | NonSharedBuffer;
1759
- export namespace realpathSync {
1742
+ function realpathSync(path: PathLike, options?: EncodingOption): string | NonSharedBuffer;
1743
+ namespace realpathSync {
1760
1744
  function native(path: PathLike, options?: EncodingOption): string;
1761
1745
  function native(path: PathLike, options: BufferEncodingOption): NonSharedBuffer;
1762
1746
  function native(path: PathLike, options?: EncodingOption): string | NonSharedBuffer;
@@ -1780,8 +1764,8 @@ declare module "fs" {
1780
1764
  * See the POSIX [`unlink(2)`](http://man7.org/linux/man-pages/man2/unlink.2.html) documentation for more details.
1781
1765
  * @since v0.0.2
1782
1766
  */
1783
- export function unlink(path: PathLike, callback: NoParamCallback): void;
1784
- export namespace unlink {
1767
+ function unlink(path: PathLike, callback: NoParamCallback): void;
1768
+ namespace unlink {
1785
1769
  /**
1786
1770
  * Asynchronous unlink(2) - delete a name and possibly the file it refers to.
1787
1771
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -1792,34 +1776,10 @@ declare module "fs" {
1792
1776
  * Synchronous [`unlink(2)`](http://man7.org/linux/man-pages/man2/unlink.2.html). Returns `undefined`.
1793
1777
  * @since v0.1.21
1794
1778
  */
1795
- export function unlinkSync(path: PathLike): void;
1796
- export interface RmDirOptions {
1797
- /**
1798
- * If an `EBUSY`, `EMFILE`, `ENFILE`, `ENOTEMPTY`, or
1799
- * `EPERM` error is encountered, Node.js will retry the operation with a linear
1800
- * backoff wait of `retryDelay` ms longer on each try. This option represents the
1801
- * number of retries. This option is ignored if the `recursive` option is not
1802
- * `true`.
1803
- * @default 0
1804
- */
1805
- maxRetries?: number | undefined;
1806
- /**
1807
- * @deprecated since v14.14.0 In future versions of Node.js and will trigger a warning
1808
- * `fs.rmdir(path, { recursive: true })` will throw if `path` does not exist or is a file.
1809
- * Use `fs.rm(path, { recursive: true, force: true })` instead.
1810
- *
1811
- * If `true`, perform a recursive directory removal. In
1812
- * recursive mode, operations are retried on failure.
1813
- * @default false
1814
- */
1815
- recursive?: boolean | undefined;
1816
- /**
1817
- * The amount of time in milliseconds to wait between retries.
1818
- * This option is ignored if the `recursive` option is not `true`.
1819
- * @default 100
1820
- */
1821
- retryDelay?: number | undefined;
1822
- }
1779
+ function unlinkSync(path: PathLike): void;
1780
+ /** @deprecated `rmdir()` no longer provides any options. This interface will be removed in a future version. */
1781
+ // TODO: remove in future major
1782
+ interface RmDirOptions {}
1823
1783
  /**
1824
1784
  * Asynchronous [`rmdir(2)`](http://man7.org/linux/man-pages/man2/rmdir.2.html). No arguments other than a possible exception are given
1825
1785
  * to the completion callback.
@@ -1830,14 +1790,13 @@ declare module "fs" {
1830
1790
  * To get a behavior similar to the `rm -rf` Unix command, use {@link rm} with options `{ recursive: true, force: true }`.
1831
1791
  * @since v0.0.2
1832
1792
  */
1833
- export function rmdir(path: PathLike, callback: NoParamCallback): void;
1834
- export function rmdir(path: PathLike, options: RmDirOptions, callback: NoParamCallback): void;
1835
- export namespace rmdir {
1793
+ function rmdir(path: PathLike, callback: NoParamCallback): void;
1794
+ namespace rmdir {
1836
1795
  /**
1837
1796
  * Asynchronous rmdir(2) - delete a directory.
1838
1797
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1839
1798
  */
1840
- function __promisify__(path: PathLike, options?: RmDirOptions): Promise<void>;
1799
+ function __promisify__(path: PathLike): Promise<void>;
1841
1800
  }
1842
1801
  /**
1843
1802
  * Synchronous [`rmdir(2)`](http://man7.org/linux/man-pages/man2/rmdir.2.html). Returns `undefined`.
@@ -1848,8 +1807,8 @@ declare module "fs" {
1848
1807
  * To get a behavior similar to the `rm -rf` Unix command, use {@link rmSync} with options `{ recursive: true, force: true }`.
1849
1808
  * @since v0.1.21
1850
1809
  */
1851
- export function rmdirSync(path: PathLike, options?: RmDirOptions): void;
1852
- export interface RmOptions {
1810
+ function rmdirSync(path: PathLike): void;
1811
+ interface RmOptions {
1853
1812
  /**
1854
1813
  * When `true`, exceptions will be ignored if `path` does not exist.
1855
1814
  * @default false
@@ -1882,9 +1841,9 @@ declare module "fs" {
1882
1841
  * completion callback.
1883
1842
  * @since v14.14.0
1884
1843
  */
1885
- export function rm(path: PathLike, callback: NoParamCallback): void;
1886
- export function rm(path: PathLike, options: RmOptions, callback: NoParamCallback): void;
1887
- export namespace rm {
1844
+ function rm(path: PathLike, callback: NoParamCallback): void;
1845
+ function rm(path: PathLike, options: RmOptions, callback: NoParamCallback): void;
1846
+ namespace rm {
1888
1847
  /**
1889
1848
  * Asynchronously removes files and directories (modeled on the standard POSIX `rm` utility).
1890
1849
  */
@@ -1894,8 +1853,8 @@ declare module "fs" {
1894
1853
  * Synchronously removes files and directories (modeled on the standard POSIX `rm` utility). Returns `undefined`.
1895
1854
  * @since v14.14.0
1896
1855
  */
1897
- export function rmSync(path: PathLike, options?: RmOptions): void;
1898
- export interface MakeDirectoryOptions {
1856
+ function rmSync(path: PathLike, options?: RmOptions): void;
1857
+ interface MakeDirectoryOptions {
1899
1858
  /**
1900
1859
  * Indicates whether parent folders should be created.
1901
1860
  * If a folder was created, the path to the first created folder will be returned.
@@ -1944,7 +1903,7 @@ declare module "fs" {
1944
1903
  * See the POSIX [`mkdir(2)`](http://man7.org/linux/man-pages/man2/mkdir.2.html) documentation for more details.
1945
1904
  * @since v0.1.8
1946
1905
  */
1947
- export function mkdir(
1906
+ function mkdir(
1948
1907
  path: PathLike,
1949
1908
  options: MakeDirectoryOptions & {
1950
1909
  recursive: true;
@@ -1957,7 +1916,7 @@ declare module "fs" {
1957
1916
  * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
1958
1917
  * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
1959
1918
  */
1960
- export function mkdir(
1919
+ function mkdir(
1961
1920
  path: PathLike,
1962
1921
  options:
1963
1922
  | Mode
@@ -1974,7 +1933,7 @@ declare module "fs" {
1974
1933
  * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
1975
1934
  * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
1976
1935
  */
1977
- export function mkdir(
1936
+ function mkdir(
1978
1937
  path: PathLike,
1979
1938
  options: Mode | MakeDirectoryOptions | null | undefined,
1980
1939
  callback: (err: NodeJS.ErrnoException | null, path?: string) => void,
@@ -1983,8 +1942,8 @@ declare module "fs" {
1983
1942
  * Asynchronous mkdir(2) - create a directory with a mode of `0o777`.
1984
1943
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1985
1944
  */
1986
- export function mkdir(path: PathLike, callback: NoParamCallback): void;
1987
- export namespace mkdir {
1945
+ function mkdir(path: PathLike, callback: NoParamCallback): void;
1946
+ namespace mkdir {
1988
1947
  /**
1989
1948
  * Asynchronous mkdir(2) - create a directory.
1990
1949
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -2030,7 +1989,7 @@ declare module "fs" {
2030
1989
  * See the POSIX [`mkdir(2)`](http://man7.org/linux/man-pages/man2/mkdir.2.html) documentation for more details.
2031
1990
  * @since v0.1.21
2032
1991
  */
2033
- export function mkdirSync(
1992
+ function mkdirSync(
2034
1993
  path: PathLike,
2035
1994
  options: MakeDirectoryOptions & {
2036
1995
  recursive: true;
@@ -2042,7 +2001,7 @@ declare module "fs" {
2042
2001
  * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
2043
2002
  * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
2044
2003
  */
2045
- export function mkdirSync(
2004
+ function mkdirSync(
2046
2005
  path: PathLike,
2047
2006
  options?:
2048
2007
  | Mode
@@ -2057,7 +2016,7 @@ declare module "fs" {
2057
2016
  * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
2058
2017
  * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
2059
2018
  */
2060
- export function mkdirSync(path: PathLike, options?: Mode | MakeDirectoryOptions | null): string | undefined;
2019
+ function mkdirSync(path: PathLike, options?: Mode | MakeDirectoryOptions | null): string | undefined;
2061
2020
  /**
2062
2021
  * Creates a unique temporary directory.
2063
2022
  *
@@ -2117,7 +2076,7 @@ declare module "fs" {
2117
2076
  * ```
2118
2077
  * @since v5.10.0
2119
2078
  */
2120
- export function mkdtemp(
2079
+ function mkdtemp(
2121
2080
  prefix: string,
2122
2081
  options: EncodingOption,
2123
2082
  callback: (err: NodeJS.ErrnoException | null, folder: string) => void,
@@ -2127,7 +2086,7 @@ declare module "fs" {
2127
2086
  * Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
2128
2087
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
2129
2088
  */
2130
- export function mkdtemp(
2089
+ function mkdtemp(
2131
2090
  prefix: string,
2132
2091
  options: BufferEncodingOption,
2133
2092
  callback: (err: NodeJS.ErrnoException | null, folder: NonSharedBuffer) => void,
@@ -2137,7 +2096,7 @@ declare module "fs" {
2137
2096
  * Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
2138
2097
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
2139
2098
  */
2140
- export function mkdtemp(
2099
+ function mkdtemp(
2141
2100
  prefix: string,
2142
2101
  options: EncodingOption,
2143
2102
  callback: (err: NodeJS.ErrnoException | null, folder: string | NonSharedBuffer) => void,
@@ -2146,11 +2105,11 @@ declare module "fs" {
2146
2105
  * Asynchronously creates a unique temporary directory.
2147
2106
  * Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
2148
2107
  */
2149
- export function mkdtemp(
2108
+ function mkdtemp(
2150
2109
  prefix: string,
2151
2110
  callback: (err: NodeJS.ErrnoException | null, folder: string) => void,
2152
2111
  ): void;
2153
- export namespace mkdtemp {
2112
+ namespace mkdtemp {
2154
2113
  /**
2155
2114
  * Asynchronously creates a unique temporary directory.
2156
2115
  * Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
@@ -2180,20 +2139,20 @@ declare module "fs" {
2180
2139
  * object with an `encoding` property specifying the character encoding to use.
2181
2140
  * @since v5.10.0
2182
2141
  */
2183
- export function mkdtempSync(prefix: string, options?: EncodingOption): string;
2142
+ function mkdtempSync(prefix: string, options?: EncodingOption): string;
2184
2143
  /**
2185
2144
  * Synchronously creates a unique temporary directory.
2186
2145
  * Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
2187
2146
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
2188
2147
  */
2189
- export function mkdtempSync(prefix: string, options: BufferEncodingOption): NonSharedBuffer;
2148
+ function mkdtempSync(prefix: string, options: BufferEncodingOption): NonSharedBuffer;
2190
2149
  /**
2191
2150
  * Synchronously creates a unique temporary directory.
2192
2151
  * Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
2193
2152
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
2194
2153
  */
2195
- export function mkdtempSync(prefix: string, options?: EncodingOption): string | NonSharedBuffer;
2196
- export interface DisposableTempDir extends AsyncDisposable {
2154
+ function mkdtempSync(prefix: string, options?: EncodingOption): string | NonSharedBuffer;
2155
+ interface DisposableTempDir extends AsyncDisposable {
2197
2156
  /**
2198
2157
  * The path of the created directory.
2199
2158
  */
@@ -2225,7 +2184,7 @@ declare module "fs" {
2225
2184
  * object with an `encoding` property specifying the character encoding to use.
2226
2185
  * @since v24.4.0
2227
2186
  */
2228
- export function mkdtempDisposableSync(prefix: string, options?: EncodingOption): DisposableTempDir;
2187
+ function mkdtempDisposableSync(prefix: string, options?: EncodingOption): DisposableTempDir;
2229
2188
  /**
2230
2189
  * Reads the contents of a directory. The callback gets two arguments `(err, files)` where `files` is an array of the names of the files in the directory excluding `'.'` and `'..'`.
2231
2190
  *
@@ -2239,7 +2198,7 @@ declare module "fs" {
2239
2198
  * If `options.withFileTypes` is set to `true`, the `files` array will contain `fs.Dirent` objects.
2240
2199
  * @since v0.1.8
2241
2200
  */
2242
- export function readdir(
2201
+ function readdir(
2243
2202
  path: PathLike,
2244
2203
  options:
2245
2204
  | {
@@ -2257,7 +2216,7 @@ declare module "fs" {
2257
2216
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2258
2217
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
2259
2218
  */
2260
- export function readdir(
2219
+ function readdir(
2261
2220
  path: PathLike,
2262
2221
  options:
2263
2222
  | {
@@ -2273,7 +2232,7 @@ declare module "fs" {
2273
2232
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2274
2233
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
2275
2234
  */
2276
- export function readdir(
2235
+ function readdir(
2277
2236
  path: PathLike,
2278
2237
  options:
2279
2238
  | (ObjectEncodingOptions & {
@@ -2289,7 +2248,7 @@ declare module "fs" {
2289
2248
  * Asynchronous readdir(3) - read a directory.
2290
2249
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2291
2250
  */
2292
- export function readdir(
2251
+ function readdir(
2293
2252
  path: PathLike,
2294
2253
  callback: (err: NodeJS.ErrnoException | null, files: string[]) => void,
2295
2254
  ): void;
@@ -2298,7 +2257,7 @@ declare module "fs" {
2298
2257
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2299
2258
  * @param options If called with `withFileTypes: true` the result data will be an array of Dirent.
2300
2259
  */
2301
- export function readdir(
2260
+ function readdir(
2302
2261
  path: PathLike,
2303
2262
  options: ObjectEncodingOptions & {
2304
2263
  withFileTypes: true;
@@ -2311,7 +2270,7 @@ declare module "fs" {
2311
2270
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2312
2271
  * @param options Must include `withFileTypes: true` and `encoding: 'buffer'`.
2313
2272
  */
2314
- export function readdir(
2273
+ function readdir(
2315
2274
  path: PathLike,
2316
2275
  options: {
2317
2276
  encoding: "buffer";
@@ -2320,7 +2279,7 @@ declare module "fs" {
2320
2279
  },
2321
2280
  callback: (err: NodeJS.ErrnoException | null, files: Dirent<NonSharedBuffer>[]) => void,
2322
2281
  ): void;
2323
- export namespace readdir {
2282
+ namespace readdir {
2324
2283
  /**
2325
2284
  * Asynchronous readdir(3) - read a directory.
2326
2285
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -2406,7 +2365,7 @@ declare module "fs" {
2406
2365
  * If `options.withFileTypes` is set to `true`, the result will contain `fs.Dirent` objects.
2407
2366
  * @since v0.1.21
2408
2367
  */
2409
- export function readdirSync(
2368
+ function readdirSync(
2410
2369
  path: PathLike,
2411
2370
  options?:
2412
2371
  | {
@@ -2422,7 +2381,7 @@ declare module "fs" {
2422
2381
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2423
2382
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
2424
2383
  */
2425
- export function readdirSync(
2384
+ function readdirSync(
2426
2385
  path: PathLike,
2427
2386
  options:
2428
2387
  | {
@@ -2437,7 +2396,7 @@ declare module "fs" {
2437
2396
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2438
2397
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
2439
2398
  */
2440
- export function readdirSync(
2399
+ function readdirSync(
2441
2400
  path: PathLike,
2442
2401
  options?:
2443
2402
  | (ObjectEncodingOptions & {
@@ -2452,7 +2411,7 @@ declare module "fs" {
2452
2411
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2453
2412
  * @param options If called with `withFileTypes: true` the result data will be an array of Dirent.
2454
2413
  */
2455
- export function readdirSync(
2414
+ function readdirSync(
2456
2415
  path: PathLike,
2457
2416
  options: ObjectEncodingOptions & {
2458
2417
  withFileTypes: true;
@@ -2464,7 +2423,7 @@ declare module "fs" {
2464
2423
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2465
2424
  * @param options Must include `withFileTypes: true` and `encoding: 'buffer'`.
2466
2425
  */
2467
- export function readdirSync(
2426
+ function readdirSync(
2468
2427
  path: PathLike,
2469
2428
  options: {
2470
2429
  encoding: "buffer";
@@ -2482,8 +2441,8 @@ declare module "fs" {
2482
2441
  * See the POSIX [`close(2)`](http://man7.org/linux/man-pages/man2/close.2.html) documentation for more detail.
2483
2442
  * @since v0.0.2
2484
2443
  */
2485
- export function close(fd: number, callback?: NoParamCallback): void;
2486
- export namespace close {
2444
+ function close(fd: number, callback?: NoParamCallback): void;
2445
+ namespace close {
2487
2446
  /**
2488
2447
  * Asynchronous close(2) - close a file descriptor.
2489
2448
  * @param fd A file descriptor.
@@ -2499,7 +2458,7 @@ declare module "fs" {
2499
2458
  * See the POSIX [`close(2)`](http://man7.org/linux/man-pages/man2/close.2.html) documentation for more detail.
2500
2459
  * @since v0.1.21
2501
2460
  */
2502
- export function closeSync(fd: number): void;
2461
+ function closeSync(fd: number): void;
2503
2462
  /**
2504
2463
  * Asynchronous file open. See the POSIX [`open(2)`](http://man7.org/linux/man-pages/man2/open.2.html) documentation for more details.
2505
2464
  *
@@ -2517,7 +2476,7 @@ declare module "fs" {
2517
2476
  * @param [flags='r'] See `support of file system `flags``.
2518
2477
  * @param [mode=0o666]
2519
2478
  */
2520
- export function open(
2479
+ function open(
2521
2480
  path: PathLike,
2522
2481
  flags: OpenMode | undefined,
2523
2482
  mode: Mode | undefined | null,
@@ -2528,7 +2487,7 @@ declare module "fs" {
2528
2487
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2529
2488
  * @param [flags='r'] See `support of file system `flags``.
2530
2489
  */
2531
- export function open(
2490
+ function open(
2532
2491
  path: PathLike,
2533
2492
  flags: OpenMode | undefined,
2534
2493
  callback: (err: NodeJS.ErrnoException | null, fd: number) => void,
@@ -2537,8 +2496,8 @@ declare module "fs" {
2537
2496
  * Asynchronous open(2) - open and possibly create a file. If the file is created, its mode will be `0o666`.
2538
2497
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2539
2498
  */
2540
- export function open(path: PathLike, callback: (err: NodeJS.ErrnoException | null, fd: number) => void): void;
2541
- export namespace open {
2499
+ function open(path: PathLike, callback: (err: NodeJS.ErrnoException | null, fd: number) => void): void;
2500
+ namespace open {
2542
2501
  /**
2543
2502
  * Asynchronous open(2) - open and possibly create a file.
2544
2503
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -2555,7 +2514,7 @@ declare module "fs" {
2555
2514
  * @param [flags='r']
2556
2515
  * @param [mode=0o666]
2557
2516
  */
2558
- export function openSync(path: PathLike, flags: OpenMode, mode?: Mode | null): number;
2517
+ function openSync(path: PathLike, flags: OpenMode, mode?: Mode | null): number;
2559
2518
  /**
2560
2519
  * Change the file system timestamps of the object referenced by `path`.
2561
2520
  *
@@ -2565,8 +2524,8 @@ declare module "fs" {
2565
2524
  * * If the value can not be converted to a number, or is `NaN`, `Infinity`, or `-Infinity`, an `Error` will be thrown.
2566
2525
  * @since v0.4.2
2567
2526
  */
2568
- export function utimes(path: PathLike, atime: TimeLike, mtime: TimeLike, callback: NoParamCallback): void;
2569
- export namespace utimes {
2527
+ function utimes(path: PathLike, atime: TimeLike, mtime: TimeLike, callback: NoParamCallback): void;
2528
+ namespace utimes {
2570
2529
  /**
2571
2530
  * Asynchronously change file timestamps of the file referenced by the supplied path.
2572
2531
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -2582,14 +2541,14 @@ declare module "fs" {
2582
2541
  * this API: {@link utimes}.
2583
2542
  * @since v0.4.2
2584
2543
  */
2585
- export function utimesSync(path: PathLike, atime: TimeLike, mtime: TimeLike): void;
2544
+ function utimesSync(path: PathLike, atime: TimeLike, mtime: TimeLike): void;
2586
2545
  /**
2587
2546
  * Change the file system timestamps of the object referenced by the supplied file
2588
2547
  * descriptor. See {@link utimes}.
2589
2548
  * @since v0.4.2
2590
2549
  */
2591
- export function futimes(fd: number, atime: TimeLike, mtime: TimeLike, callback: NoParamCallback): void;
2592
- export namespace futimes {
2550
+ function futimes(fd: number, atime: TimeLike, mtime: TimeLike, callback: NoParamCallback): void;
2551
+ namespace futimes {
2593
2552
  /**
2594
2553
  * Asynchronously change file timestamps of the file referenced by the supplied file descriptor.
2595
2554
  * @param fd A file descriptor.
@@ -2602,7 +2561,7 @@ declare module "fs" {
2602
2561
  * Synchronous version of {@link futimes}. Returns `undefined`.
2603
2562
  * @since v0.4.2
2604
2563
  */
2605
- export function futimesSync(fd: number, atime: TimeLike, mtime: TimeLike): void;
2564
+ function futimesSync(fd: number, atime: TimeLike, mtime: TimeLike): void;
2606
2565
  /**
2607
2566
  * Request that all data for the open file descriptor is flushed to the storage
2608
2567
  * device. The specific implementation is operating system and device specific.
@@ -2610,8 +2569,8 @@ declare module "fs" {
2610
2569
  * than a possible exception are given to the completion callback.
2611
2570
  * @since v0.1.96
2612
2571
  */
2613
- export function fsync(fd: number, callback: NoParamCallback): void;
2614
- export namespace fsync {
2572
+ function fsync(fd: number, callback: NoParamCallback): void;
2573
+ namespace fsync {
2615
2574
  /**
2616
2575
  * Asynchronous fsync(2) - synchronize a file's in-core state with the underlying storage device.
2617
2576
  * @param fd A file descriptor.
@@ -2624,8 +2583,8 @@ declare module "fs" {
2624
2583
  * Refer to the POSIX [`fsync(2)`](http://man7.org/linux/man-pages/man2/fsync.2.html) documentation for more detail. Returns `undefined`.
2625
2584
  * @since v0.1.96
2626
2585
  */
2627
- export function fsyncSync(fd: number): void;
2628
- export interface WriteOptions {
2586
+ function fsyncSync(fd: number): void;
2587
+ interface WriteOptions {
2629
2588
  /**
2630
2589
  * @default 0
2631
2590
  */
@@ -2666,7 +2625,7 @@ declare module "fs" {
2666
2625
  * @param [length=buffer.byteLength - offset]
2667
2626
  * @param [position='null']
2668
2627
  */
2669
- export function write<TBuffer extends NodeJS.ArrayBufferView>(
2628
+ function write<TBuffer extends NodeJS.ArrayBufferView>(
2670
2629
  fd: number,
2671
2630
  buffer: TBuffer,
2672
2631
  offset: number | undefined | null,
@@ -2680,7 +2639,7 @@ declare module "fs" {
2680
2639
  * @param offset The part of the buffer to be written. If not supplied, defaults to `0`.
2681
2640
  * @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`.
2682
2641
  */
2683
- export function write<TBuffer extends NodeJS.ArrayBufferView>(
2642
+ function write<TBuffer extends NodeJS.ArrayBufferView>(
2684
2643
  fd: number,
2685
2644
  buffer: TBuffer,
2686
2645
  offset: number | undefined | null,
@@ -2692,7 +2651,7 @@ declare module "fs" {
2692
2651
  * @param fd A file descriptor.
2693
2652
  * @param offset The part of the buffer to be written. If not supplied, defaults to `0`.
2694
2653
  */
2695
- export function write<TBuffer extends NodeJS.ArrayBufferView>(
2654
+ function write<TBuffer extends NodeJS.ArrayBufferView>(
2696
2655
  fd: number,
2697
2656
  buffer: TBuffer,
2698
2657
  offset: number | undefined | null,
@@ -2702,7 +2661,7 @@ declare module "fs" {
2702
2661
  * Asynchronously writes `buffer` to the file referenced by the supplied file descriptor.
2703
2662
  * @param fd A file descriptor.
2704
2663
  */
2705
- export function write<TBuffer extends NodeJS.ArrayBufferView>(
2664
+ function write<TBuffer extends NodeJS.ArrayBufferView>(
2706
2665
  fd: number,
2707
2666
  buffer: TBuffer,
2708
2667
  callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void,
@@ -2715,7 +2674,7 @@ declare module "fs" {
2715
2674
  * * `length` The number of bytes to write. If not supplied, defaults to `buffer.length - offset`.
2716
2675
  * * `position` The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
2717
2676
  */
2718
- export function write<TBuffer extends NodeJS.ArrayBufferView>(
2677
+ function write<TBuffer extends NodeJS.ArrayBufferView>(
2719
2678
  fd: number,
2720
2679
  buffer: TBuffer,
2721
2680
  options: WriteOptions,
@@ -2728,7 +2687,7 @@ declare module "fs" {
2728
2687
  * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
2729
2688
  * @param encoding The expected string encoding.
2730
2689
  */
2731
- export function write(
2690
+ function write(
2732
2691
  fd: number,
2733
2692
  string: string,
2734
2693
  position: number | undefined | null,
@@ -2741,7 +2700,7 @@ declare module "fs" {
2741
2700
  * @param string A string to write.
2742
2701
  * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
2743
2702
  */
2744
- export function write(
2703
+ function write(
2745
2704
  fd: number,
2746
2705
  string: string,
2747
2706
  position: number | undefined | null,
@@ -2752,12 +2711,12 @@ declare module "fs" {
2752
2711
  * @param fd A file descriptor.
2753
2712
  * @param string A string to write.
2754
2713
  */
2755
- export function write(
2714
+ function write(
2756
2715
  fd: number,
2757
2716
  string: string,
2758
2717
  callback: (err: NodeJS.ErrnoException | null, written: number, str: string) => void,
2759
2718
  ): void;
2760
- export namespace write {
2719
+ namespace write {
2761
2720
  /**
2762
2721
  * Asynchronously writes `buffer` to the file referenced by the supplied file descriptor.
2763
2722
  * @param fd A file descriptor.
@@ -2817,7 +2776,7 @@ declare module "fs" {
2817
2776
  * @param [position='null']
2818
2777
  * @return The number of bytes written.
2819
2778
  */
2820
- export function writeSync(
2779
+ function writeSync(
2821
2780
  fd: number,
2822
2781
  buffer: NodeJS.ArrayBufferView,
2823
2782
  offset?: number | null,
@@ -2831,14 +2790,14 @@ declare module "fs" {
2831
2790
  * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
2832
2791
  * @param encoding The expected string encoding.
2833
2792
  */
2834
- export function writeSync(
2793
+ function writeSync(
2835
2794
  fd: number,
2836
2795
  string: string,
2837
2796
  position?: number | null,
2838
2797
  encoding?: BufferEncoding | null,
2839
2798
  ): number;
2840
- export type ReadPosition = number | bigint;
2841
- export interface ReadOptions {
2799
+ type ReadPosition = number | bigint;
2800
+ interface ReadOptions {
2842
2801
  /**
2843
2802
  * @default 0
2844
2803
  */
@@ -2852,15 +2811,15 @@ declare module "fs" {
2852
2811
  */
2853
2812
  position?: ReadPosition | null | undefined;
2854
2813
  }
2855
- export interface ReadOptionsWithBuffer<T extends NodeJS.ArrayBufferView> extends ReadOptions {
2814
+ interface ReadOptionsWithBuffer<T extends NodeJS.ArrayBufferView> extends ReadOptions {
2856
2815
  buffer?: T | undefined;
2857
2816
  }
2858
2817
  /** @deprecated Use `ReadOptions` instead. */
2859
2818
  // TODO: remove in future major
2860
- export interface ReadSyncOptions extends ReadOptions {}
2819
+ interface ReadSyncOptions extends ReadOptions {}
2861
2820
  /** @deprecated Use `ReadOptionsWithBuffer` instead. */
2862
2821
  // TODO: remove in future major
2863
- export interface ReadAsyncOptions<T extends NodeJS.ArrayBufferView> extends ReadOptionsWithBuffer<T> {}
2822
+ interface ReadAsyncOptions<T extends NodeJS.ArrayBufferView> extends ReadOptionsWithBuffer<T> {}
2864
2823
  /**
2865
2824
  * Read data from the file specified by `fd`.
2866
2825
  *
@@ -2878,7 +2837,7 @@ declare module "fs" {
2878
2837
  * @param position Specifies where to begin reading from in the file. If `position` is `null` or `-1 `, data will be read from the current file position, and the file position will be updated. If
2879
2838
  * `position` is an integer, the file position will be unchanged.
2880
2839
  */
2881
- export function read<TBuffer extends NodeJS.ArrayBufferView>(
2840
+ function read<TBuffer extends NodeJS.ArrayBufferView>(
2882
2841
  fd: number,
2883
2842
  buffer: TBuffer,
2884
2843
  offset: number,
@@ -2895,27 +2854,27 @@ declare module "fs" {
2895
2854
  * `position` defaults to `null`
2896
2855
  * @since v12.17.0, 13.11.0
2897
2856
  */
2898
- export function read<TBuffer extends NodeJS.ArrayBufferView = NonSharedBuffer>(
2857
+ function read<TBuffer extends NodeJS.ArrayBufferView = NonSharedBuffer>(
2899
2858
  fd: number,
2900
2859
  options: ReadOptionsWithBuffer<TBuffer>,
2901
2860
  callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: TBuffer) => void,
2902
2861
  ): void;
2903
- export function read<TBuffer extends NodeJS.ArrayBufferView>(
2862
+ function read<TBuffer extends NodeJS.ArrayBufferView>(
2904
2863
  fd: number,
2905
2864
  buffer: TBuffer,
2906
2865
  options: ReadOptions,
2907
2866
  callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: TBuffer) => void,
2908
2867
  ): void;
2909
- export function read<TBuffer extends NodeJS.ArrayBufferView>(
2868
+ function read<TBuffer extends NodeJS.ArrayBufferView>(
2910
2869
  fd: number,
2911
2870
  buffer: TBuffer,
2912
2871
  callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: TBuffer) => void,
2913
2872
  ): void;
2914
- export function read(
2873
+ function read(
2915
2874
  fd: number,
2916
2875
  callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: NonSharedBuffer) => void,
2917
2876
  ): void;
2918
- export namespace read {
2877
+ namespace read {
2919
2878
  /**
2920
2879
  * @param fd A file descriptor.
2921
2880
  * @param buffer The buffer that the data will be written to.
@@ -2953,7 +2912,7 @@ declare module "fs" {
2953
2912
  * @since v0.1.21
2954
2913
  * @param [position='null']
2955
2914
  */
2956
- export function readSync(
2915
+ function readSync(
2957
2916
  fd: number,
2958
2917
  buffer: NodeJS.ArrayBufferView,
2959
2918
  offset: number,
@@ -2964,7 +2923,7 @@ declare module "fs" {
2964
2923
  * Similar to the above `fs.readSync` function, this version takes an optional `options` object.
2965
2924
  * If no `options` object is specified, it will default with the above values.
2966
2925
  */
2967
- export function readSync(fd: number, buffer: NodeJS.ArrayBufferView, opts?: ReadOptions): number;
2926
+ function readSync(fd: number, buffer: NodeJS.ArrayBufferView, opts?: ReadOptions): number;
2968
2927
  /**
2969
2928
  * Asynchronously reads the entire contents of a file.
2970
2929
  *
@@ -3031,7 +2990,7 @@ declare module "fs" {
3031
2990
  * @since v0.1.29
3032
2991
  * @param path filename or file descriptor
3033
2992
  */
3034
- export function readFile(
2993
+ function readFile(
3035
2994
  path: PathOrFileDescriptor,
3036
2995
  options:
3037
2996
  | ({
@@ -3049,7 +3008,7 @@ declare module "fs" {
3049
3008
  * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
3050
3009
  * If a flag is not provided, it defaults to `'r'`.
3051
3010
  */
3052
- export function readFile(
3011
+ function readFile(
3053
3012
  path: PathOrFileDescriptor,
3054
3013
  options:
3055
3014
  | ({
@@ -3066,7 +3025,7 @@ declare module "fs" {
3066
3025
  * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
3067
3026
  * If a flag is not provided, it defaults to `'r'`.
3068
3027
  */
3069
- export function readFile(
3028
+ function readFile(
3070
3029
  path: PathOrFileDescriptor,
3071
3030
  options:
3072
3031
  | (ObjectEncodingOptions & {
@@ -3082,11 +3041,11 @@ declare module "fs" {
3082
3041
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
3083
3042
  * If a file descriptor is provided, the underlying file will _not_ be closed automatically.
3084
3043
  */
3085
- export function readFile(
3044
+ function readFile(
3086
3045
  path: PathOrFileDescriptor,
3087
3046
  callback: (err: NodeJS.ErrnoException | null, data: NonSharedBuffer) => void,
3088
3047
  ): void;
3089
- export namespace readFile {
3048
+ namespace readFile {
3090
3049
  /**
3091
3050
  * Asynchronously reads the entire contents of a file.
3092
3051
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -3160,7 +3119,7 @@ declare module "fs" {
3160
3119
  * @since v0.1.8
3161
3120
  * @param path filename or file descriptor
3162
3121
  */
3163
- export function readFileSync(
3122
+ function readFileSync(
3164
3123
  path: PathOrFileDescriptor,
3165
3124
  options?: {
3166
3125
  encoding?: null | undefined;
@@ -3174,7 +3133,7 @@ declare module "fs" {
3174
3133
  * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
3175
3134
  * If a flag is not provided, it defaults to `'r'`.
3176
3135
  */
3177
- export function readFileSync(
3136
+ function readFileSync(
3178
3137
  path: PathOrFileDescriptor,
3179
3138
  options:
3180
3139
  | {
@@ -3190,7 +3149,7 @@ declare module "fs" {
3190
3149
  * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
3191
3150
  * If a flag is not provided, it defaults to `'r'`.
3192
3151
  */
3193
- export function readFileSync(
3152
+ function readFileSync(
3194
3153
  path: PathOrFileDescriptor,
3195
3154
  options?:
3196
3155
  | (ObjectEncodingOptions & {
@@ -3199,7 +3158,7 @@ declare module "fs" {
3199
3158
  | BufferEncoding
3200
3159
  | null,
3201
3160
  ): string | NonSharedBuffer;
3202
- export type WriteFileOptions =
3161
+ type WriteFileOptions =
3203
3162
  | (
3204
3163
  & ObjectEncodingOptions
3205
3164
  & Abortable
@@ -3272,7 +3231,7 @@ declare module "fs" {
3272
3231
  * @since v0.1.29
3273
3232
  * @param file filename or file descriptor
3274
3233
  */
3275
- export function writeFile(
3234
+ function writeFile(
3276
3235
  file: PathOrFileDescriptor,
3277
3236
  data: string | NodeJS.ArrayBufferView,
3278
3237
  options: WriteFileOptions,
@@ -3284,12 +3243,12 @@ declare module "fs" {
3284
3243
  * If a file descriptor is provided, the underlying file will _not_ be closed automatically.
3285
3244
  * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string.
3286
3245
  */
3287
- export function writeFile(
3246
+ function writeFile(
3288
3247
  path: PathOrFileDescriptor,
3289
3248
  data: string | NodeJS.ArrayBufferView,
3290
3249
  callback: NoParamCallback,
3291
3250
  ): void;
3292
- export namespace writeFile {
3251
+ namespace writeFile {
3293
3252
  /**
3294
3253
  * Asynchronously writes data to a file, replacing the file if it already exists.
3295
3254
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -3318,7 +3277,7 @@ declare module "fs" {
3318
3277
  * @since v0.1.29
3319
3278
  * @param file filename or file descriptor
3320
3279
  */
3321
- export function writeFileSync(
3280
+ function writeFileSync(
3322
3281
  file: PathOrFileDescriptor,
3323
3282
  data: string | NodeJS.ArrayBufferView,
3324
3283
  options?: WriteFileOptions,
@@ -3376,7 +3335,7 @@ declare module "fs" {
3376
3335
  * @since v0.6.7
3377
3336
  * @param path filename or file descriptor
3378
3337
  */
3379
- export function appendFile(
3338
+ function appendFile(
3380
3339
  path: PathOrFileDescriptor,
3381
3340
  data: string | Uint8Array,
3382
3341
  options: WriteFileOptions,
@@ -3388,8 +3347,8 @@ declare module "fs" {
3388
3347
  * If a file descriptor is provided, the underlying file will _not_ be closed automatically.
3389
3348
  * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string.
3390
3349
  */
3391
- export function appendFile(file: PathOrFileDescriptor, data: string | Uint8Array, callback: NoParamCallback): void;
3392
- export namespace appendFile {
3350
+ function appendFile(file: PathOrFileDescriptor, data: string | Uint8Array, callback: NoParamCallback): void;
3351
+ namespace appendFile {
3393
3352
  /**
3394
3353
  * Asynchronously append data to a file, creating the file if it does not exist.
3395
3354
  * @param file A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -3455,7 +3414,7 @@ declare module "fs" {
3455
3414
  * @since v0.6.7
3456
3415
  * @param path filename or file descriptor
3457
3416
  */
3458
- export function appendFileSync(
3417
+ function appendFileSync(
3459
3418
  path: PathOrFileDescriptor,
3460
3419
  data: string | Uint8Array,
3461
3420
  options?: WriteFileOptions,
@@ -3506,7 +3465,7 @@ declare module "fs" {
3506
3465
  * * the file is renamed and then renamed a second time back to its original name
3507
3466
  * @since v0.1.31
3508
3467
  */
3509
- export interface WatchFileOptions {
3468
+ interface WatchFileOptions {
3510
3469
  bigint?: boolean | undefined;
3511
3470
  persistent?: boolean | undefined;
3512
3471
  interval?: number | undefined;
@@ -3557,7 +3516,7 @@ declare module "fs" {
3557
3516
  * * the file is renamed and then renamed a second time back to its original name
3558
3517
  * @since v0.1.31
3559
3518
  */
3560
- export function watchFile(
3519
+ function watchFile(
3561
3520
  filename: PathLike,
3562
3521
  options:
3563
3522
  | (WatchFileOptions & {
@@ -3566,7 +3525,7 @@ declare module "fs" {
3566
3525
  | undefined,
3567
3526
  listener: StatsListener,
3568
3527
  ): StatWatcher;
3569
- export function watchFile(
3528
+ function watchFile(
3570
3529
  filename: PathLike,
3571
3530
  options:
3572
3531
  | (WatchFileOptions & {
@@ -3579,7 +3538,7 @@ declare module "fs" {
3579
3538
  * Watch for changes on `filename`. The callback `listener` will be called each time the file is accessed.
3580
3539
  * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
3581
3540
  */
3582
- export function watchFile(filename: PathLike, listener: StatsListener): StatWatcher;
3541
+ function watchFile(filename: PathLike, listener: StatsListener): StatWatcher;
3583
3542
  /**
3584
3543
  * Stop watching for changes on `filename`. If `listener` is specified, only that
3585
3544
  * particular listener is removed. Otherwise, _all_ listeners are removed,
@@ -3592,23 +3551,23 @@ declare module "fs" {
3592
3551
  * @since v0.1.31
3593
3552
  * @param listener Optional, a listener previously attached using `fs.watchFile()`
3594
3553
  */
3595
- export function unwatchFile(filename: PathLike, listener?: StatsListener): void;
3596
- export function unwatchFile(filename: PathLike, listener?: BigIntStatsListener): void;
3597
- export interface WatchOptions extends Abortable {
3554
+ function unwatchFile(filename: PathLike, listener?: StatsListener): void;
3555
+ function unwatchFile(filename: PathLike, listener?: BigIntStatsListener): void;
3556
+ interface WatchOptions extends Abortable {
3598
3557
  encoding?: BufferEncoding | "buffer" | undefined;
3599
3558
  persistent?: boolean | undefined;
3600
3559
  recursive?: boolean | undefined;
3601
3560
  }
3602
- export interface WatchOptionsWithBufferEncoding extends WatchOptions {
3561
+ interface WatchOptionsWithBufferEncoding extends WatchOptions {
3603
3562
  encoding: "buffer";
3604
3563
  }
3605
- export interface WatchOptionsWithStringEncoding extends WatchOptions {
3564
+ interface WatchOptionsWithStringEncoding extends WatchOptions {
3606
3565
  encoding?: BufferEncoding | undefined;
3607
3566
  }
3608
- export type WatchEventType = "rename" | "change";
3609
- export type WatchListener<T> = (event: WatchEventType, filename: T | null) => void;
3610
- export type StatsListener = (curr: Stats, prev: Stats) => void;
3611
- export type BigIntStatsListener = (curr: BigIntStats, prev: BigIntStats) => void;
3567
+ type WatchEventType = "rename" | "change";
3568
+ type WatchListener<T> = (event: WatchEventType, filename: T | null) => void;
3569
+ type StatsListener = (curr: Stats, prev: Stats) => void;
3570
+ type BigIntStatsListener = (curr: BigIntStats, prev: BigIntStats) => void;
3612
3571
  /**
3613
3572
  * Watch for changes on `filename`, where `filename` is either a file or a
3614
3573
  * directory.
@@ -3629,22 +3588,22 @@ declare module "fs" {
3629
3588
  * @since v0.5.10
3630
3589
  * @param listener
3631
3590
  */
3632
- export function watch(
3591
+ function watch(
3633
3592
  filename: PathLike,
3634
3593
  options?: WatchOptionsWithStringEncoding | BufferEncoding | null,
3635
3594
  listener?: WatchListener<string>,
3636
3595
  ): FSWatcher;
3637
- export function watch(
3596
+ function watch(
3638
3597
  filename: PathLike,
3639
3598
  options: WatchOptionsWithBufferEncoding | "buffer",
3640
3599
  listener: WatchListener<NonSharedBuffer>,
3641
3600
  ): FSWatcher;
3642
- export function watch(
3601
+ function watch(
3643
3602
  filename: PathLike,
3644
3603
  options: WatchOptions | BufferEncoding | "buffer" | null,
3645
3604
  listener: WatchListener<string | NonSharedBuffer>,
3646
3605
  ): FSWatcher;
3647
- export function watch(filename: PathLike, listener: WatchListener<string>): FSWatcher;
3606
+ function watch(filename: PathLike, listener: WatchListener<string>): FSWatcher;
3648
3607
  /**
3649
3608
  * Test whether or not the given path exists by checking with the file system.
3650
3609
  * Then call the `callback` argument with either true or false:
@@ -3774,9 +3733,9 @@ declare module "fs" {
3774
3733
  * @since v0.0.2
3775
3734
  * @deprecated Since v1.0.0 - Use {@link stat} or {@link access} instead.
3776
3735
  */
3777
- export function exists(path: PathLike, callback: (exists: boolean) => void): void;
3736
+ function exists(path: PathLike, callback: (exists: boolean) => void): void;
3778
3737
  /** @deprecated */
3779
- export namespace exists {
3738
+ namespace exists {
3780
3739
  /**
3781
3740
  * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
3782
3741
  * URL support is _experimental_.
@@ -3800,8 +3759,8 @@ declare module "fs" {
3800
3759
  * ```
3801
3760
  * @since v0.1.21
3802
3761
  */
3803
- export function existsSync(path: PathLike): boolean;
3804
- export namespace constants {
3762
+ function existsSync(path: PathLike): boolean;
3763
+ namespace constants {
3805
3764
  // File Access Constants
3806
3765
  /** Constant for fs.access(). File is visible to the calling process. */
3807
3766
  const F_OK: number;
@@ -4075,13 +4034,13 @@ declare module "fs" {
4075
4034
  * @since v0.11.15
4076
4035
  * @param [mode=fs.constants.F_OK]
4077
4036
  */
4078
- export function access(path: PathLike, mode: number | undefined, callback: NoParamCallback): void;
4037
+ function access(path: PathLike, mode: number | undefined, callback: NoParamCallback): void;
4079
4038
  /**
4080
4039
  * Asynchronously tests a user's permissions for the file specified by path.
4081
4040
  * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
4082
4041
  */
4083
- export function access(path: PathLike, callback: NoParamCallback): void;
4084
- export namespace access {
4042
+ function access(path: PathLike, callback: NoParamCallback): void;
4043
+ namespace access {
4085
4044
  /**
4086
4045
  * Asynchronously tests a user's permissions for the file specified by path.
4087
4046
  * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
@@ -4112,11 +4071,11 @@ declare module "fs" {
4112
4071
  * @since v0.11.15
4113
4072
  * @param [mode=fs.constants.F_OK]
4114
4073
  */
4115
- export function accessSync(path: PathLike, mode?: number): void;
4074
+ function accessSync(path: PathLike, mode?: number): void;
4116
4075
  interface StreamOptions {
4117
4076
  flags?: string | undefined;
4118
4077
  encoding?: BufferEncoding | undefined;
4119
- fd?: number | promises.FileHandle | undefined;
4078
+ fd?: number | FileHandle | undefined;
4120
4079
  mode?: number | undefined;
4121
4080
  autoClose?: boolean | undefined;
4122
4081
  emitClose?: boolean | undefined;
@@ -4204,7 +4163,7 @@ declare module "fs" {
4204
4163
  * If `options` is a string, then it specifies the encoding.
4205
4164
  * @since v0.1.31
4206
4165
  */
4207
- export function createReadStream(path: PathLike, options?: BufferEncoding | ReadStreamOptions): ReadStream;
4166
+ function createReadStream(path: PathLike, options?: BufferEncoding | ReadStreamOptions): ReadStream;
4208
4167
  /**
4209
4168
  * `options` may also include a `start` option to allow writing data at some
4210
4169
  * position past the beginning of the file, allowed values are in the
@@ -4232,7 +4191,7 @@ declare module "fs" {
4232
4191
  * If `options` is a string, then it specifies the encoding.
4233
4192
  * @since v0.1.31
4234
4193
  */
4235
- export function createWriteStream(path: PathLike, options?: BufferEncoding | WriteStreamOptions): WriteStream;
4194
+ function createWriteStream(path: PathLike, options?: BufferEncoding | WriteStreamOptions): WriteStream;
4236
4195
  /**
4237
4196
  * Forces all currently queued I/O operations associated with the file to the
4238
4197
  * operating system's synchronized I/O completion state. Refer to the POSIX [`fdatasync(2)`](http://man7.org/linux/man-pages/man2/fdatasync.2.html) documentation for details. No arguments other
@@ -4240,8 +4199,8 @@ declare module "fs" {
4240
4199
  * exception are given to the completion callback.
4241
4200
  * @since v0.1.96
4242
4201
  */
4243
- export function fdatasync(fd: number, callback: NoParamCallback): void;
4244
- export namespace fdatasync {
4202
+ function fdatasync(fd: number, callback: NoParamCallback): void;
4203
+ namespace fdatasync {
4245
4204
  /**
4246
4205
  * Asynchronous fdatasync(2) - synchronize a file's in-core state with storage device.
4247
4206
  * @param fd A file descriptor.
@@ -4253,7 +4212,7 @@ declare module "fs" {
4253
4212
  * operating system's synchronized I/O completion state. Refer to the POSIX [`fdatasync(2)`](http://man7.org/linux/man-pages/man2/fdatasync.2.html) documentation for details. Returns `undefined`.
4254
4213
  * @since v0.1.96
4255
4214
  */
4256
- export function fdatasyncSync(fd: number): void;
4215
+ function fdatasyncSync(fd: number): void;
4257
4216
  /**
4258
4217
  * Asynchronously copies `src` to `dest`. By default, `dest` is overwritten if it
4259
4218
  * already exists. No arguments other than a possible exception are given to the
@@ -4293,9 +4252,9 @@ declare module "fs" {
4293
4252
  * @param dest destination filename of the copy operation
4294
4253
  * @param [mode=0] modifiers for copy operation.
4295
4254
  */
4296
- export function copyFile(src: PathLike, dest: PathLike, callback: NoParamCallback): void;
4297
- export function copyFile(src: PathLike, dest: PathLike, mode: number, callback: NoParamCallback): void;
4298
- export namespace copyFile {
4255
+ function copyFile(src: PathLike, dest: PathLike, callback: NoParamCallback): void;
4256
+ function copyFile(src: PathLike, dest: PathLike, mode: number, callback: NoParamCallback): void;
4257
+ namespace copyFile {
4299
4258
  function __promisify__(src: PathLike, dst: PathLike, mode?: number): Promise<void>;
4300
4259
  }
4301
4260
  /**
@@ -4332,7 +4291,7 @@ declare module "fs" {
4332
4291
  * @param dest destination filename of the copy operation
4333
4292
  * @param [mode=0] modifiers for copy operation.
4334
4293
  */
4335
- export function copyFileSync(src: PathLike, dest: PathLike, mode?: number): void;
4294
+ function copyFileSync(src: PathLike, dest: PathLike, mode?: number): void;
4336
4295
  /**
4337
4296
  * Write an array of `ArrayBufferView`s to the file specified by `fd` using `writev()`.
4338
4297
  *
@@ -4353,12 +4312,12 @@ declare module "fs" {
4353
4312
  * @since v12.9.0
4354
4313
  * @param [position='null']
4355
4314
  */
4356
- export function writev<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
4315
+ function writev<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
4357
4316
  fd: number,
4358
4317
  buffers: TBuffers,
4359
4318
  cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers: TBuffers) => void,
4360
4319
  ): void;
4361
- export function writev<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
4320
+ function writev<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
4362
4321
  fd: number,
4363
4322
  buffers: TBuffers,
4364
4323
  position: number | null,
@@ -4366,11 +4325,11 @@ declare module "fs" {
4366
4325
  ): void;
4367
4326
  // Providing a default type parameter doesn't provide true BC for userland consumers, but at least suppresses TS2314
4368
4327
  // TODO: remove default in future major version
4369
- export interface WriteVResult<T extends readonly NodeJS.ArrayBufferView[] = NodeJS.ArrayBufferView[]> {
4328
+ interface WriteVResult<T extends readonly NodeJS.ArrayBufferView[] = NodeJS.ArrayBufferView[]> {
4370
4329
  bytesWritten: number;
4371
4330
  buffers: T;
4372
4331
  }
4373
- export namespace writev {
4332
+ namespace writev {
4374
4333
  function __promisify__<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
4375
4334
  fd: number,
4376
4335
  buffers: TBuffers,
@@ -4384,7 +4343,7 @@ declare module "fs" {
4384
4343
  * @param [position='null']
4385
4344
  * @return The number of bytes written.
4386
4345
  */
4387
- export function writevSync(fd: number, buffers: readonly NodeJS.ArrayBufferView[], position?: number): number;
4346
+ function writevSync(fd: number, buffers: readonly NodeJS.ArrayBufferView[], position?: number): number;
4388
4347
  /**
4389
4348
  * Read from a file specified by `fd` and write to an array of `ArrayBufferView`s
4390
4349
  * using `readv()`.
@@ -4400,12 +4359,12 @@ declare module "fs" {
4400
4359
  * @since v13.13.0, v12.17.0
4401
4360
  * @param [position='null']
4402
4361
  */
4403
- export function readv<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
4362
+ function readv<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
4404
4363
  fd: number,
4405
4364
  buffers: TBuffers,
4406
4365
  cb: (err: NodeJS.ErrnoException | null, bytesRead: number, buffers: TBuffers) => void,
4407
4366
  ): void;
4408
- export function readv<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
4367
+ function readv<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
4409
4368
  fd: number,
4410
4369
  buffers: TBuffers,
4411
4370
  position: number | null,
@@ -4413,11 +4372,11 @@ declare module "fs" {
4413
4372
  ): void;
4414
4373
  // Providing a default type parameter doesn't provide true BC for userland consumers, but at least suppresses TS2314
4415
4374
  // TODO: remove default in future major version
4416
- export interface ReadVResult<T extends readonly NodeJS.ArrayBufferView[] = NodeJS.ArrayBufferView[]> {
4375
+ interface ReadVResult<T extends readonly NodeJS.ArrayBufferView[] = NodeJS.ArrayBufferView[]> {
4417
4376
  bytesRead: number;
4418
4377
  buffers: T;
4419
4378
  }
4420
- export namespace readv {
4379
+ namespace readv {
4421
4380
  function __promisify__<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
4422
4381
  fd: number,
4423
4382
  buffers: TBuffers,
@@ -4431,9 +4390,9 @@ declare module "fs" {
4431
4390
  * @param [position='null']
4432
4391
  * @return The number of bytes read.
4433
4392
  */
4434
- export function readvSync(fd: number, buffers: readonly NodeJS.ArrayBufferView[], position?: number): number;
4393
+ function readvSync(fd: number, buffers: readonly NodeJS.ArrayBufferView[], position?: number): number;
4435
4394
 
4436
- export interface OpenAsBlobOptions {
4395
+ interface OpenAsBlobOptions {
4437
4396
  /**
4438
4397
  * An optional mime type for the blob.
4439
4398
  *
@@ -4459,9 +4418,9 @@ declare module "fs" {
4459
4418
  * ```
4460
4419
  * @since v19.8.0
4461
4420
  */
4462
- export function openAsBlob(path: PathLike, options?: OpenAsBlobOptions): Promise<Blob>;
4421
+ function openAsBlob(path: PathLike, options?: OpenAsBlobOptions): Promise<Blob>;
4463
4422
 
4464
- export interface OpenDirOptions {
4423
+ interface OpenDirOptions {
4465
4424
  /**
4466
4425
  * @default 'utf8'
4467
4426
  */
@@ -4488,7 +4447,7 @@ declare module "fs" {
4488
4447
  * directory and subsequent read operations.
4489
4448
  * @since v12.12.0
4490
4449
  */
4491
- export function opendirSync(path: PathLike, options?: OpenDirOptions): Dir;
4450
+ function opendirSync(path: PathLike, options?: OpenDirOptions): Dir;
4492
4451
  /**
4493
4452
  * Asynchronously open a directory. See the POSIX [`opendir(3)`](http://man7.org/linux/man-pages/man3/opendir.3.html) documentation for
4494
4453
  * more details.
@@ -4500,28 +4459,28 @@ declare module "fs" {
4500
4459
  * directory and subsequent read operations.
4501
4460
  * @since v12.12.0
4502
4461
  */
4503
- export function opendir(path: PathLike, cb: (err: NodeJS.ErrnoException | null, dir: Dir) => void): void;
4504
- export function opendir(
4462
+ function opendir(path: PathLike, cb: (err: NodeJS.ErrnoException | null, dir: Dir) => void): void;
4463
+ function opendir(
4505
4464
  path: PathLike,
4506
4465
  options: OpenDirOptions,
4507
4466
  cb: (err: NodeJS.ErrnoException | null, dir: Dir) => void,
4508
4467
  ): void;
4509
- export namespace opendir {
4468
+ namespace opendir {
4510
4469
  function __promisify__(path: PathLike, options?: OpenDirOptions): Promise<Dir>;
4511
4470
  }
4512
- export interface BigIntStats extends StatsBase<bigint> {
4471
+ interface BigIntStats extends StatsBase<bigint> {
4513
4472
  atimeNs: bigint;
4514
4473
  mtimeNs: bigint;
4515
4474
  ctimeNs: bigint;
4516
4475
  birthtimeNs: bigint;
4517
4476
  }
4518
- export interface BigIntOptions {
4477
+ interface BigIntOptions {
4519
4478
  bigint: true;
4520
4479
  }
4521
- export interface StatOptions {
4480
+ interface StatOptions {
4522
4481
  bigint?: boolean | undefined;
4523
4482
  }
4524
- export interface StatSyncOptions extends StatOptions {
4483
+ interface StatSyncOptions extends StatOptions {
4525
4484
  throwIfNoEntry?: boolean | undefined;
4526
4485
  }
4527
4486
  interface CopyOptionsBase {
@@ -4564,14 +4523,14 @@ declare module "fs" {
4564
4523
  */
4565
4524
  verbatimSymlinks?: boolean | undefined;
4566
4525
  }
4567
- export interface CopyOptions extends CopyOptionsBase {
4526
+ interface CopyOptions extends CopyOptionsBase {
4568
4527
  /**
4569
4528
  * Function to filter copied files/directories. Return
4570
4529
  * `true` to copy the item, `false` to ignore it.
4571
4530
  */
4572
4531
  filter?: ((source: string, destination: string) => boolean | Promise<boolean>) | undefined;
4573
4532
  }
4574
- export interface CopySyncOptions extends CopyOptionsBase {
4533
+ interface CopySyncOptions extends CopyOptionsBase {
4575
4534
  /**
4576
4535
  * Function to filter copied files/directories. Return
4577
4536
  * `true` to copy the item, `false` to ignore it.
@@ -4589,12 +4548,12 @@ declare module "fs" {
4589
4548
  * @param src source path to copy.
4590
4549
  * @param dest destination path to copy to.
4591
4550
  */
4592
- export function cp(
4551
+ function cp(
4593
4552
  source: string | URL,
4594
4553
  destination: string | URL,
4595
4554
  callback: (err: NodeJS.ErrnoException | null) => void,
4596
4555
  ): void;
4597
- export function cp(
4556
+ function cp(
4598
4557
  source: string | URL,
4599
4558
  destination: string | URL,
4600
4559
  opts: CopyOptions,
@@ -4611,7 +4570,7 @@ declare module "fs" {
4611
4570
  * @param src source path to copy.
4612
4571
  * @param dest destination path to copy to.
4613
4572
  */
4614
- export function cpSync(source: string | URL, destination: string | URL, opts?: CopySyncOptions): void;
4573
+ function cpSync(source: string | URL, destination: string | URL, opts?: CopySyncOptions): void;
4615
4574
 
4616
4575
  // TODO: collapse
4617
4576
  interface _GlobOptions<T extends Dirent | string> {
@@ -4637,11 +4596,11 @@ declare module "fs" {
4637
4596
  */
4638
4597
  exclude?: ((fileName: T) => boolean) | readonly string[] | undefined;
4639
4598
  }
4640
- export interface GlobOptions extends _GlobOptions<Dirent | string> {}
4641
- export interface GlobOptionsWithFileTypes extends _GlobOptions<Dirent> {
4599
+ interface GlobOptions extends _GlobOptions<Dirent | string> {}
4600
+ interface GlobOptionsWithFileTypes extends _GlobOptions<Dirent> {
4642
4601
  withFileTypes: true;
4643
4602
  }
4644
- export interface GlobOptionsWithoutFileTypes extends _GlobOptions<string> {
4603
+ interface GlobOptionsWithoutFileTypes extends _GlobOptions<string> {
4645
4604
  withFileTypes?: false | undefined;
4646
4605
  }
4647
4606
 
@@ -4658,11 +4617,11 @@ declare module "fs" {
4658
4617
  * ```
4659
4618
  * @since v22.0.0
4660
4619
  */
4661
- export function glob(
4620
+ function glob(
4662
4621
  pattern: string | readonly string[],
4663
4622
  callback: (err: NodeJS.ErrnoException | null, matches: string[]) => void,
4664
4623
  ): void;
4665
- export function glob(
4624
+ function glob(
4666
4625
  pattern: string | readonly string[],
4667
4626
  options: GlobOptionsWithFileTypes,
4668
4627
  callback: (
@@ -4670,7 +4629,7 @@ declare module "fs" {
4670
4629
  matches: Dirent[],
4671
4630
  ) => void,
4672
4631
  ): void;
4673
- export function glob(
4632
+ function glob(
4674
4633
  pattern: string | readonly string[],
4675
4634
  options: GlobOptionsWithoutFileTypes,
4676
4635
  callback: (
@@ -4678,7 +4637,7 @@ declare module "fs" {
4678
4637
  matches: string[],
4679
4638
  ) => void,
4680
4639
  ): void;
4681
- export function glob(
4640
+ function glob(
4682
4641
  pattern: string | readonly string[],
4683
4642
  options: GlobOptions,
4684
4643
  callback: (
@@ -4695,20 +4654,23 @@ declare module "fs" {
4695
4654
  * @since v22.0.0
4696
4655
  * @returns paths of files that match the pattern.
4697
4656
  */
4698
- export function globSync(pattern: string | readonly string[]): string[];
4699
- export function globSync(
4657
+ function globSync(pattern: string | readonly string[]): string[];
4658
+ function globSync(
4700
4659
  pattern: string | readonly string[],
4701
4660
  options: GlobOptionsWithFileTypes,
4702
4661
  ): Dirent[];
4703
- export function globSync(
4662
+ function globSync(
4704
4663
  pattern: string | readonly string[],
4705
4664
  options: GlobOptionsWithoutFileTypes,
4706
4665
  ): string[];
4707
- export function globSync(
4666
+ function globSync(
4708
4667
  pattern: string | readonly string[],
4709
4668
  options: GlobOptions,
4710
4669
  ): Dirent[] | string[];
4711
4670
  }
4712
4671
  declare module "node:fs" {
4713
- export * from "fs";
4672
+ export * as promises from "node:fs/promises";
4673
+ }
4674
+ declare module "fs" {
4675
+ export * from "node:fs";
4714
4676
  }