@idlebox/stripe-node-types 24.0.14-patch.0 → 24.0.15

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 (134) hide show
  1. package/README.md +1 -1
  2. package/assert/strict.d.ts +113 -1
  3. package/assert.d.ts +162 -248
  4. package/async_hooks.d.ts +20 -5
  5. package/buffer.buffer.d.ts +24 -6
  6. package/buffer.d.ts +63 -168
  7. package/child_process.d.ts +117 -223
  8. package/cluster.d.ts +251 -329
  9. package/compatibility/iterators.d.ts +15 -0
  10. package/console.d.ts +60 -346
  11. package/constants.d.ts +15 -1
  12. package/crypto.d.ts +713 -1149
  13. package/dgram.d.ts +30 -50
  14. package/diagnostics_channel.d.ts +16 -3
  15. package/dns/promises.d.ts +15 -0
  16. package/dns.d.ts +150 -131
  17. package/domain.d.ts +25 -14
  18. package/events.d.ts +858 -719
  19. package/fs/promises.d.ts +117 -53
  20. package/fs.d.ts +729 -484
  21. package/globals.d.ts +142 -344
  22. package/globals.typedarray.d.ts +94 -0
  23. package/http.d.ts +358 -246
  24. package/http2.d.ts +578 -711
  25. package/https.d.ts +85 -216
  26. package/index.d.ts +39 -3
  27. package/inspector/promises.d.ts +54 -0
  28. package/inspector.d.ts +180 -3936
  29. package/inspector.generated.d.ts +4242 -0
  30. package/module.d.ts +60 -95
  31. package/my-shim.d.ts +15 -0
  32. package/net.d.ts +102 -186
  33. package/os.d.ts +32 -6
  34. package/package.json +3 -8
  35. package/path/posix.d.ts +20 -0
  36. package/path/win32.d.ts +20 -0
  37. package/path.d.ts +132 -122
  38. package/perf_hooks.d.ts +310 -644
  39. package/process.d.ts +192 -138
  40. package/punycode.d.ts +17 -2
  41. package/querystring.d.ts +16 -1
  42. package/quic.d.ts +926 -0
  43. package/readline/promises.d.ts +16 -1
  44. package/readline.d.ts +80 -118
  45. package/repl.d.ts +98 -96
  46. package/sea.d.ts +25 -1
  47. package/sqlite.d.ts +277 -13
  48. package/stream/consumers.d.ts +22 -7
  49. package/stream/promises.d.ts +148 -12
  50. package/stream/web.d.ts +187 -494
  51. package/stream.d.ts +608 -490
  52. package/string_decoder.d.ts +18 -3
  53. package/test/reporters.d.ts +112 -0
  54. package/test.d.ts +238 -199
  55. package/timers/promises.d.ts +16 -1
  56. package/timers.d.ts +16 -129
  57. package/tls.d.ts +163 -163
  58. package/trace_events.d.ts +21 -6
  59. package/ts5.6/buffer.buffer.d.ts +25 -8
  60. package/ts5.6/compatibility/float16array.d.ts +15 -0
  61. package/ts5.6/globals.typedarray.d.ts +31 -0
  62. package/ts5.6/index.d.ts +39 -3
  63. package/ts5.7/compatibility/float16array.d.ts +15 -0
  64. package/ts5.7/index.d.ts +39 -3
  65. package/tty.d.ts +70 -13
  66. package/undici-types/agent.d.ts +20 -4
  67. package/undici-types/api.d.ts +15 -0
  68. package/undici-types/balanced-pool.d.ts +15 -0
  69. package/undici-types/cache-interceptor.d.ts +15 -0
  70. package/undici-types/cache.d.ts +15 -0
  71. package/undici-types/client-stats.d.ts +31 -0
  72. package/undici-types/client.d.ts +21 -5
  73. package/undici-types/connector.d.ts +15 -0
  74. package/undici-types/content-type.d.ts +15 -0
  75. package/undici-types/cookies.d.ts +15 -0
  76. package/undici-types/diagnostics-channel.d.ts +24 -1
  77. package/undici-types/dispatcher.d.ts +18 -8
  78. package/undici-types/env-http-proxy-agent.d.ts +17 -1
  79. package/undici-types/errors.d.ts +20 -15
  80. package/undici-types/eventsource.d.ts +24 -4
  81. package/undici-types/fetch.d.ts +16 -0
  82. package/undici-types/formdata.d.ts +15 -0
  83. package/undici-types/global-dispatcher.d.ts +15 -0
  84. package/undici-types/global-origin.d.ts +15 -0
  85. package/undici-types/h2c-client.d.ts +15 -2
  86. package/undici-types/handlers.d.ts +16 -1
  87. package/undici-types/header.d.ts +15 -0
  88. package/undici-types/index.d.ts +21 -1
  89. package/undici-types/interceptors.d.ts +20 -0
  90. package/undici-types/mock-agent.d.ts +18 -0
  91. package/undici-types/mock-call-history.d.ts +15 -0
  92. package/undici-types/mock-client.d.ts +17 -0
  93. package/undici-types/mock-errors.d.ts +15 -0
  94. package/undici-types/mock-interceptor.d.ts +17 -1
  95. package/undici-types/mock-pool.d.ts +17 -0
  96. package/undici-types/package.json +1 -1
  97. package/undici-types/patch.d.ts +15 -0
  98. package/undici-types/pool-stats.d.ts +15 -0
  99. package/undici-types/pool.d.ts +17 -0
  100. package/undici-types/proxy-agent.d.ts +16 -0
  101. package/undici-types/readable.d.ts +15 -0
  102. package/undici-types/retry-agent.d.ts +15 -0
  103. package/undici-types/retry-handler.d.ts +24 -0
  104. package/undici-types/snapshot-agent.d.ts +125 -0
  105. package/undici-types/util.d.ts +15 -0
  106. package/undici-types/utility.d.ts +15 -0
  107. package/undici-types/webidl.d.ts +126 -36
  108. package/undici-types/websocket.d.ts +18 -1
  109. package/url.d.ts +107 -587
  110. package/util/types.d.ts +571 -0
  111. package/util.d.ts +158 -792
  112. package/v8.d.ts +82 -7
  113. package/vm.d.ts +267 -108
  114. package/wasi.d.ts +38 -2
  115. package/web-globals/abortcontroller.d.ts +75 -0
  116. package/web-globals/blob.d.ts +39 -0
  117. package/web-globals/console.d.ts +25 -0
  118. package/web-globals/crypto.d.ts +55 -0
  119. package/web-globals/domexception.d.ts +84 -0
  120. package/web-globals/encoding.d.ts +27 -0
  121. package/{dom-events.d.ts → web-globals/events.d.ts} +72 -50
  122. package/web-globals/fetch.d.ts +70 -0
  123. package/web-globals/importmeta.d.ts +29 -0
  124. package/web-globals/messaging.d.ts +39 -0
  125. package/web-globals/navigator.d.ts +41 -0
  126. package/web-globals/performance.d.ts +61 -0
  127. package/web-globals/storage.d.ts +40 -0
  128. package/web-globals/streams.d.ts +131 -0
  129. package/web-globals/timers.d.ts +60 -0
  130. package/web-globals/url.d.ts +40 -0
  131. package/worker_threads.d.ts +306 -349
  132. package/zlib.d.ts +59 -94
  133. package/ts5.1/compatibility/disposable.d.ts +0 -13
  134. package/ts5.1/index.d.ts +0 -100
package/fs.d.ts CHANGED
@@ -1,3 +1,18 @@
1
+ // biome-ignore-all lint: generated file
2
+ // biome-ignore-all assist: generated file
3
+ /* eslint-disable */
4
+ // @ts-ignore
5
+
6
+ /******************************************************************************
7
+ * GENERATED FILE, DO NOT MODIFY
8
+ * 这是生成的文件,千万不要修改
9
+ *
10
+ * @build-script/codegen - The Simple Code Generater
11
+ * https://github.com/GongT/baobao
12
+ *
13
+ ******************************************************************************/
14
+
15
+
1
16
  /**
2
17
  * The `node:fs` module enables interacting with the file system in a
3
18
  * way modeled on standard POSIX functions.
@@ -16,34 +31,34 @@
16
31
  *
17
32
  * All file system operations have synchronous, callback, and promise-based
18
33
  * 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)
34
+ * @see [source](https://github.com/nodejs/node/blob/v25.x/lib/fs.js)
20
35
  */
21
36
 
22
37
  declare module "_not-use-node-type_fs" {
38
+ import { NonSharedBuffer } from 'node:buffer';
39
+ import { Abortable, EventEmitter, InternalEventEmitter } from 'node:events';
40
+ import { FileHandle } from 'node:fs/promises';
23
41
  import * as stream from 'node:stream';
24
- import { Abortable, EventEmitter } from 'node:events';
25
42
  import { URL } from 'node:url';
26
- import * as promises from 'node:fs/promises';
27
- export { promises };
28
43
  /**
29
44
  * Valid types for path values in "fs".
30
45
  */
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 =
46
+ type PathLike = string | Buffer | URL;
47
+ type PathOrFileDescriptor = PathLike | number;
48
+ type TimeLike = string | number | Date;
49
+ type NoParamCallback = (err: NodeJS.ErrnoException | null) => void;
50
+ type BufferEncodingOption =
36
51
  | "buffer"
37
52
  | {
38
53
  encoding: "buffer";
39
54
  };
40
- export interface ObjectEncodingOptions {
55
+ interface ObjectEncodingOptions {
41
56
  encoding?: BufferEncoding | null | undefined;
42
57
  }
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> {
58
+ type EncodingOption = ObjectEncodingOptions | BufferEncoding | undefined | null;
59
+ type OpenMode = number | string;
60
+ type Mode = number | string;
61
+ interface StatsBase<T> {
47
62
  isFile(): boolean;
48
63
  isDirectory(): boolean;
49
64
  isBlockDevice(): boolean;
@@ -70,7 +85,7 @@ declare module "_not-use-node-type_fs" {
70
85
  ctime: Date;
71
86
  birthtime: Date;
72
87
  }
73
- export interface Stats extends StatsBase<number> {}
88
+ interface Stats extends StatsBase<number> {}
74
89
  /**
75
90
  * A `fs.Stats` object provides information about a file.
76
91
  *
@@ -131,10 +146,10 @@ declare module "_not-use-node-type_fs" {
131
146
  * ```
132
147
  * @since v0.1.21
133
148
  */
134
- export class Stats {
149
+ class Stats {
135
150
  private constructor();
136
151
  }
137
- export interface StatsFsBase<T> {
152
+ interface StatsFsBase<T> {
138
153
  /** Type of file system. */
139
154
  type: T;
140
155
  /** Optimal transfer block size. */
@@ -150,7 +165,7 @@ declare module "_not-use-node-type_fs" {
150
165
  /** Free file nodes in file system. */
151
166
  ffree: T;
152
167
  }
153
- export interface StatsFs extends StatsFsBase<number> {}
168
+ interface StatsFs extends StatsFsBase<number> {}
154
169
  /**
155
170
  * Provides information about a mounted file system.
156
171
  *
@@ -185,9 +200,9 @@ declare module "_not-use-node-type_fs" {
185
200
  * ```
186
201
  * @since v19.6.0, v18.15.0
187
202
  */
188
- export class StatsFs {}
189
- export interface BigIntStatsFs extends StatsFsBase<bigint> {}
190
- export interface StatFsOptions {
203
+ class StatsFs {}
204
+ interface BigIntStatsFs extends StatsFsBase<bigint> {}
205
+ interface StatFsOptions {
191
206
  bigint?: boolean | undefined;
192
207
  }
193
208
  /**
@@ -199,7 +214,7 @@ declare module "_not-use-node-type_fs" {
199
214
  * the `withFileTypes` option set to `true`, the resulting array is filled with `fs.Dirent` objects, rather than strings or `Buffer` s.
200
215
  * @since v10.10.0
201
216
  */
202
- export class Dirent<Name extends string | Buffer = string> {
217
+ class Dirent<Name extends string | Buffer = string> {
203
218
  /**
204
219
  * Returns `true` if the `fs.Dirent` object describes a regular file.
205
220
  * @since v10.10.0
@@ -270,7 +285,7 @@ declare module "_not-use-node-type_fs" {
270
285
  * closed after the iterator exits.
271
286
  * @since v12.12.0
272
287
  */
273
- export class Dir implements AsyncIterable<Dirent> {
288
+ class Dir implements AsyncIterable<Dirent> {
274
289
  /**
275
290
  * The read-only path of this directory as was provided to {@link opendir},{@link opendirSync}, or `fsPromises.opendir()`.
276
291
  * @since v12.12.0
@@ -323,6 +338,18 @@ declare module "_not-use-node-type_fs" {
323
338
  * @since v12.12.0
324
339
  */
325
340
  readSync(): Dirent | null;
341
+ /**
342
+ * Calls `dir.close()` if the directory handle is open, and returns a promise that
343
+ * fulfills when disposal is complete.
344
+ * @since v24.1.0
345
+ */
346
+ [Symbol.asyncDispose](): Promise<void>;
347
+ /**
348
+ * Calls `dir.closeSync()` if the directory handle is open, and returns
349
+ * `undefined`.
350
+ * @since v24.1.0
351
+ */
352
+ [Symbol.dispose](): void;
326
353
  }
327
354
  /**
328
355
  * Class: fs.StatWatcher
@@ -330,7 +357,7 @@ declare module "_not-use-node-type_fs" {
330
357
  * Extends `EventEmitter`
331
358
  * A successful call to {@link watchFile} method will return a new fs.StatWatcher object.
332
359
  */
333
- export interface StatWatcher extends EventEmitter {
360
+ interface StatWatcher extends EventEmitter {
334
361
  /**
335
362
  * 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
336
363
  * no effect.
@@ -351,7 +378,12 @@ declare module "_not-use-node-type_fs" {
351
378
  */
352
379
  unref(): this;
353
380
  }
354
- export interface FSWatcher extends EventEmitter {
381
+ interface FSWatcherEventMap {
382
+ "change": [eventType: string, filename: string | NonSharedBuffer];
383
+ "close": [];
384
+ "error": [error: Error];
385
+ }
386
+ interface FSWatcher extends InternalEventEmitter<FSWatcherEventMap> {
355
387
  /**
356
388
  * Stop watching for changes on the given `fs.FSWatcher`. Once stopped, the `fs.FSWatcher` object is no longer usable.
357
389
  * @since v0.5.8
@@ -376,38 +408,18 @@ declare module "_not-use-node-type_fs" {
376
408
  * @since v14.3.0, v12.20.0
377
409
  */
378
410
  unref(): this;
379
- /**
380
- * events.EventEmitter
381
- * 1. change
382
- * 2. close
383
- * 3. error
384
- */
385
- addListener(event: string, listener: (...args: any[]) => void): this;
386
- addListener(event: "change", listener: (eventType: string, filename: string | Buffer) => void): this;
387
- addListener(event: "close", listener: () => void): this;
388
- addListener(event: "error", listener: (error: Error) => void): this;
389
- on(event: string, listener: (...args: any[]) => void): this;
390
- on(event: "change", listener: (eventType: string, filename: string | Buffer) => void): this;
391
- on(event: "close", listener: () => void): this;
392
- on(event: "error", listener: (error: Error) => void): this;
393
- once(event: string, listener: (...args: any[]) => void): this;
394
- once(event: "change", listener: (eventType: string, filename: string | Buffer) => void): this;
395
- once(event: "close", listener: () => void): this;
396
- once(event: "error", listener: (error: Error) => void): this;
397
- prependListener(event: string, listener: (...args: any[]) => void): this;
398
- prependListener(event: "change", listener: (eventType: string, filename: string | Buffer) => void): this;
399
- prependListener(event: "close", listener: () => void): this;
400
- prependListener(event: "error", listener: (error: Error) => void): this;
401
- prependOnceListener(event: string, listener: (...args: any[]) => void): this;
402
- prependOnceListener(event: "change", listener: (eventType: string, filename: string | Buffer) => void): this;
403
- prependOnceListener(event: "close", listener: () => void): this;
404
- prependOnceListener(event: "error", listener: (error: Error) => void): this;
411
+ }
412
+ interface ReadStreamEventMap extends stream.ReadableEventMap {
413
+ "close": [];
414
+ "data": [chunk: string | NonSharedBuffer];
415
+ "open": [fd: number];
416
+ "ready": [];
405
417
  }
406
418
  /**
407
419
  * Instances of `fs.ReadStream` are created and returned using the {@link createReadStream} function.
408
420
  * @since v0.1.93
409
421
  */
410
- export class ReadStream extends stream.Readable {
422
+ class ReadStream extends stream.Readable {
411
423
  close(callback?: (err?: NodeJS.ErrnoException | null) => void): void;
412
424
  /**
413
425
  * The number of bytes that have been read so far.
@@ -427,60 +439,250 @@ declare module "_not-use-node-type_fs" {
427
439
  * @since v11.2.0, v10.16.0
428
440
  */
429
441
  pending: boolean;
442
+ // #region InternalEventEmitter
443
+ addListener<E extends keyof ReadStreamEventMap>(
444
+ eventName: E,
445
+ listener: (...args: ReadStreamEventMap[E]) => void,
446
+ ): this;
447
+ addListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
448
+ emit<E extends keyof ReadStreamEventMap>(eventName: E, ...args: ReadStreamEventMap[E]): boolean;
449
+ emit(eventName: string | symbol, ...args: any[]): boolean;
450
+ listenerCount<E extends keyof ReadStreamEventMap>(
451
+ eventName: E,
452
+ listener?: (...args: ReadStreamEventMap[E]) => void,
453
+ ): number;
454
+ listenerCount(eventName: string | symbol, listener?: (...args: any[]) => void): number;
455
+ listeners<E extends keyof ReadStreamEventMap>(eventName: E): ((...args: ReadStreamEventMap[E]) => void)[];
456
+ listeners(eventName: string | symbol): ((...args: any[]) => void)[];
457
+ off<E extends keyof ReadStreamEventMap>(eventName: E, listener: (...args: ReadStreamEventMap[E]) => void): this;
458
+ off(eventName: string | symbol, listener: (...args: any[]) => void): this;
459
+ on<E extends keyof ReadStreamEventMap>(eventName: E, listener: (...args: ReadStreamEventMap[E]) => void): this;
460
+ on(eventName: string | symbol, listener: (...args: any[]) => void): this;
461
+ once<E extends keyof ReadStreamEventMap>(
462
+ eventName: E,
463
+ listener: (...args: ReadStreamEventMap[E]) => void,
464
+ ): this;
465
+ once(eventName: string | symbol, listener: (...args: any[]) => void): this;
466
+ prependListener<E extends keyof ReadStreamEventMap>(
467
+ eventName: E,
468
+ listener: (...args: ReadStreamEventMap[E]) => void,
469
+ ): this;
470
+ prependListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
471
+ prependOnceListener<E extends keyof ReadStreamEventMap>(
472
+ eventName: E,
473
+ listener: (...args: ReadStreamEventMap[E]) => void,
474
+ ): this;
475
+ prependOnceListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
476
+ rawListeners<E extends keyof ReadStreamEventMap>(eventName: E): ((...args: ReadStreamEventMap[E]) => void)[];
477
+ rawListeners(eventName: string | symbol): ((...args: any[]) => void)[];
478
+ // eslint-disable-next-line @definitelytyped/no-unnecessary-generics
479
+ removeAllListeners<E extends keyof ReadStreamEventMap>(eventName?: E): this;
480
+ removeAllListeners(eventName?: string | symbol): this;
481
+ removeListener<E extends keyof ReadStreamEventMap>(
482
+ eventName: E,
483
+ listener: (...args: ReadStreamEventMap[E]) => void,
484
+ ): this;
485
+ removeListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
486
+ // #endregion
487
+ }
488
+ interface Utf8StreamOptions {
489
+ /**
490
+ * Appends writes to dest file instead of truncating it.
491
+ * @default true
492
+ */
493
+ append?: boolean | undefined;
494
+ /**
495
+ * Which type of data you can send to the write
496
+ * function, supported values are `'utf8'` or `'buffer'`.
497
+ * @default 'utf8'
498
+ */
499
+ contentMode?: "utf8" | "buffer" | undefined;
500
+ /**
501
+ * A path to a file to be written to (mode controlled by the
502
+ * append option).
503
+ */
504
+ dest?: string | undefined;
505
+ /**
506
+ * A file descriptor, something that is returned by `fs.open()`
507
+ * or `fs.openSync()`.
508
+ */
509
+ fd?: number | undefined;
430
510
  /**
431
- * events.EventEmitter
432
- * 1. open
433
- * 2. close
434
- * 3. ready
511
+ * An object that has the same API as the `fs` module, useful
512
+ * for mocking, testing, or customizing the behavior of the stream.
435
513
  */
436
- addListener<K extends keyof ReadStreamEvents>(event: K, listener: ReadStreamEvents[K]): this;
437
- on<K extends keyof ReadStreamEvents>(event: K, listener: ReadStreamEvents[K]): this;
438
- once<K extends keyof ReadStreamEvents>(event: K, listener: ReadStreamEvents[K]): this;
439
- prependListener<K extends keyof ReadStreamEvents>(event: K, listener: ReadStreamEvents[K]): this;
440
- prependOnceListener<K extends keyof ReadStreamEvents>(event: K, listener: ReadStreamEvents[K]): this;
514
+ fs?: object | undefined;
515
+ /**
516
+ * Perform a `fs.fsyncSync()` every time a write is
517
+ * completed.
518
+ */
519
+ fsync?: boolean | undefined;
520
+ /**
521
+ * The maximum length of the internal buffer. If a write
522
+ * operation would cause the buffer to exceed `maxLength`, the data written is
523
+ * dropped and a drop event is emitted with the dropped data
524
+ */
525
+ maxLength?: number | undefined;
526
+ /**
527
+ * The maximum number of bytes that can be written;
528
+ * @default 16384
529
+ */
530
+ maxWrite?: number | undefined;
531
+ /**
532
+ * The minimum length of the internal buffer that is
533
+ * required to be full before flushing.
534
+ */
535
+ minLength?: number | undefined;
536
+ /**
537
+ * Ensure directory for `dest` file exists when true.
538
+ * @default false
539
+ */
540
+ mkdir?: boolean | undefined;
541
+ /**
542
+ * Specify the creating file mode (see `fs.open()`).
543
+ */
544
+ mode?: number | string | undefined;
545
+ /**
546
+ * Calls flush every `periodicFlush` milliseconds.
547
+ */
548
+ periodicFlush?: number | undefined;
549
+ /**
550
+ * A function that will be called when `write()`,
551
+ * `writeSync()`, or `flushSync()` encounters an `EAGAIN` or `EBUSY` error.
552
+ * If the return value is `true` the operation will be retried, otherwise it
553
+ * will bubble the error. The `err` is the error that caused this function to
554
+ * be called, `writeBufferLen` is the length of the buffer that was written,
555
+ * and `remainingBufferLen` is the length of the remaining buffer that the
556
+ * stream did not try to write.
557
+ */
558
+ retryEAGAIN?: ((err: Error | null, writeBufferLen: number, remainingBufferLen: number) => boolean) | undefined;
559
+ /**
560
+ * Perform writes synchronously.
561
+ */
562
+ sync?: boolean | undefined;
563
+ }
564
+ interface Utf8StreamEventMap {
565
+ "close": [];
566
+ "drain": [];
567
+ "drop": [data: string | Buffer];
568
+ "error": [error: Error];
569
+ "finish": [];
570
+ "ready": [];
571
+ "write": [n: number];
441
572
  }
442
-
443
- /**
444
- * The Keys are events of the ReadStream and the values are the functions that are called when the event is emitted.
445
- */
446
- type ReadStreamEvents = {
447
- close: () => void;
448
- data: (chunk: Buffer | string) => void;
449
- end: () => void;
450
- error: (err: Error) => void;
451
- open: (fd: number) => void;
452
- pause: () => void;
453
- readable: () => void;
454
- ready: () => void;
455
- resume: () => void;
456
- } & CustomEvents;
457
-
458
- /**
459
- * string & {} allows to allow any kind of strings for the event
460
- * but still allows to have auto completion for the normal events.
461
- */
462
- type CustomEvents = { [Key in string & {} | symbol]: (...args: any[]) => void };
463
-
464
573
  /**
465
- * The Keys are events of the WriteStream and the values are the functions that are called when the event is emitted.
574
+ * An optimized UTF-8 stream writer that allows for flushing all the internal
575
+ * buffering on demand. It handles `EAGAIN` errors correctly, allowing for
576
+ * customization, for example, by dropping content if the disk is busy.
577
+ * @since v24.6.0
578
+ * @experimental
466
579
  */
467
- type WriteStreamEvents = {
468
- close: () => void;
469
- drain: () => void;
470
- error: (err: Error) => void;
471
- finish: () => void;
472
- open: (fd: number) => void;
473
- pipe: (src: stream.Readable) => void;
474
- ready: () => void;
475
- unpipe: (src: stream.Readable) => void;
476
- } & CustomEvents;
580
+ class Utf8Stream implements EventEmitter {
581
+ constructor(options: Utf8StreamOptions);
582
+ /**
583
+ * Whether the stream is appending to the file or truncating it.
584
+ */
585
+ readonly append: boolean;
586
+ /**
587
+ * The type of data that can be written to the stream. Supported
588
+ * values are `'utf8'` or `'buffer'`.
589
+ * @default 'utf8'
590
+ */
591
+ readonly contentMode: "utf8" | "buffer";
592
+ /**
593
+ * Close the stream immediately, without flushing the internal buffer.
594
+ */
595
+ destroy(): void;
596
+ /**
597
+ * Close the stream gracefully, flushing the internal buffer before closing.
598
+ */
599
+ end(): void;
600
+ /**
601
+ * The file descriptor that is being written to.
602
+ */
603
+ readonly fd: number;
604
+ /**
605
+ * The file that is being written to.
606
+ */
607
+ readonly file: string;
608
+ /**
609
+ * Writes the current buffer to the file if a write was not in progress. Do
610
+ * nothing if `minLength` is zero or if it is already writing.
611
+ */
612
+ flush(callback: (err: Error | null) => void): void;
613
+ /**
614
+ * Flushes the buffered data synchronously. This is a costly operation.
615
+ */
616
+ flushSync(): void;
617
+ /**
618
+ * Whether the stream is performing a `fs.fsyncSync()` after every
619
+ * write operation.
620
+ */
621
+ readonly fsync: boolean;
622
+ /**
623
+ * The maximum length of the internal buffer. If a write
624
+ * operation would cause the buffer to exceed `maxLength`, the data written is
625
+ * dropped and a drop event is emitted with the dropped data.
626
+ */
627
+ readonly maxLength: number;
628
+ /**
629
+ * The minimum length of the internal buffer that is required to be
630
+ * full before flushing.
631
+ */
632
+ readonly minLength: number;
633
+ /**
634
+ * Whether the stream should ensure that the directory for the
635
+ * `dest` file exists. If `true`, it will create the directory if it does not
636
+ * exist.
637
+ * @default false
638
+ */
639
+ readonly mkdir: boolean;
640
+ /**
641
+ * The mode of the file that is being written to.
642
+ */
643
+ readonly mode: number | string;
644
+ /**
645
+ * The number of milliseconds between flushes. If set to `0`, no
646
+ * periodic flushes will be performed.
647
+ */
648
+ readonly periodicFlush: number;
649
+ /**
650
+ * Reopen the file in place, useful for log rotation.
651
+ * @param file A path to a file to be written to (mode
652
+ * controlled by the append option).
653
+ */
654
+ reopen(file: PathLike): void;
655
+ /**
656
+ * Whether the stream is writing synchronously or asynchronously.
657
+ */
658
+ readonly sync: boolean;
659
+ /**
660
+ * When the `options.contentMode` is set to `'utf8'` when the stream is created,
661
+ * the `data` argument must be a string. If the `contentMode` is set to `'buffer'`,
662
+ * the `data` argument must be a `Buffer`.
663
+ * @param data The data to write.
664
+ */
665
+ write(data: string | Buffer): boolean;
666
+ /**
667
+ * Whether the stream is currently writing data to the file.
668
+ */
669
+ readonly writing: boolean;
670
+ /**
671
+ * Calls `utf8Stream.destroy()`.
672
+ */
673
+ [Symbol.dispose](): void;
674
+ }
675
+ interface Utf8Stream extends InternalEventEmitter<Utf8StreamEventMap> {}
676
+ interface WriteStreamEventMap extends stream.WritableEventMap {
677
+ "close": [];
678
+ "open": [fd: number];
679
+ "ready": [];
680
+ }
477
681
  /**
478
- * * Extends `stream.Writable`
479
- *
480
682
  * Instances of `fs.WriteStream` are created and returned using the {@link createWriteStream} function.
481
683
  * @since v0.1.93
482
684
  */
483
- export class WriteStream extends stream.Writable {
685
+ class WriteStream extends stream.Writable {
484
686
  /**
485
687
  * Closes `writeStream`. Optionally accepts a
486
688
  * callback that will be executed once the `writeStream`is closed.
@@ -506,17 +708,57 @@ declare module "_not-use-node-type_fs" {
506
708
  * @since v11.2.0
507
709
  */
508
710
  pending: boolean;
509
- /**
510
- * events.EventEmitter
511
- * 1. open
512
- * 2. close
513
- * 3. ready
514
- */
515
- addListener<K extends keyof WriteStreamEvents>(event: K, listener: WriteStreamEvents[K]): this;
516
- on<K extends keyof WriteStreamEvents>(event: K, listener: WriteStreamEvents[K]): this;
517
- once<K extends keyof WriteStreamEvents>(event: K, listener: WriteStreamEvents[K]): this;
518
- prependListener<K extends keyof WriteStreamEvents>(event: K, listener: WriteStreamEvents[K]): this;
519
- prependOnceListener<K extends keyof WriteStreamEvents>(event: K, listener: WriteStreamEvents[K]): this;
711
+ // #region InternalEventEmitter
712
+ addListener<E extends keyof WriteStreamEventMap>(
713
+ eventName: E,
714
+ listener: (...args: WriteStreamEventMap[E]) => void,
715
+ ): this;
716
+ addListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
717
+ emit<E extends keyof WriteStreamEventMap>(eventName: E, ...args: WriteStreamEventMap[E]): boolean;
718
+ emit(eventName: string | symbol, ...args: any[]): boolean;
719
+ listenerCount<E extends keyof WriteStreamEventMap>(
720
+ eventName: E,
721
+ listener?: (...args: WriteStreamEventMap[E]) => void,
722
+ ): number;
723
+ listenerCount(eventName: string | symbol, listener?: (...args: any[]) => void): number;
724
+ listeners<E extends keyof WriteStreamEventMap>(eventName: E): ((...args: WriteStreamEventMap[E]) => void)[];
725
+ listeners(eventName: string | symbol): ((...args: any[]) => void)[];
726
+ off<E extends keyof WriteStreamEventMap>(
727
+ eventName: E,
728
+ listener: (...args: WriteStreamEventMap[E]) => void,
729
+ ): this;
730
+ off(eventName: string | symbol, listener: (...args: any[]) => void): this;
731
+ on<E extends keyof WriteStreamEventMap>(
732
+ eventName: E,
733
+ listener: (...args: WriteStreamEventMap[E]) => void,
734
+ ): this;
735
+ on(eventName: string | symbol, listener: (...args: any[]) => void): this;
736
+ once<E extends keyof WriteStreamEventMap>(
737
+ eventName: E,
738
+ listener: (...args: WriteStreamEventMap[E]) => void,
739
+ ): this;
740
+ once(eventName: string | symbol, listener: (...args: any[]) => void): this;
741
+ prependListener<E extends keyof WriteStreamEventMap>(
742
+ eventName: E,
743
+ listener: (...args: WriteStreamEventMap[E]) => void,
744
+ ): this;
745
+ prependListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
746
+ prependOnceListener<E extends keyof WriteStreamEventMap>(
747
+ eventName: E,
748
+ listener: (...args: WriteStreamEventMap[E]) => void,
749
+ ): this;
750
+ prependOnceListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
751
+ rawListeners<E extends keyof WriteStreamEventMap>(eventName: E): ((...args: WriteStreamEventMap[E]) => void)[];
752
+ rawListeners(eventName: string | symbol): ((...args: any[]) => void)[];
753
+ // eslint-disable-next-line @definitelytyped/no-unnecessary-generics
754
+ removeAllListeners<E extends keyof WriteStreamEventMap>(eventName?: E): this;
755
+ removeAllListeners(eventName?: string | symbol): this;
756
+ removeListener<E extends keyof WriteStreamEventMap>(
757
+ eventName: E,
758
+ listener: (...args: WriteStreamEventMap[E]) => void,
759
+ ): this;
760
+ removeListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
761
+ // #endregion
520
762
  }
521
763
  /**
522
764
  * Asynchronously rename file at `oldPath` to the pathname provided
@@ -537,8 +779,8 @@ declare module "_not-use-node-type_fs" {
537
779
  * ```
538
780
  * @since v0.0.2
539
781
  */
540
- export function rename(oldPath: PathLike, newPath: PathLike, callback: NoParamCallback): void;
541
- export namespace rename {
782
+ function rename(oldPath: PathLike, newPath: PathLike, callback: NoParamCallback): void;
783
+ namespace rename {
542
784
  /**
543
785
  * Asynchronous rename(2) - Change the name or location of a file or directory.
544
786
  * @param oldPath A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -554,7 +796,7 @@ declare module "_not-use-node-type_fs" {
554
796
  * See the POSIX [`rename(2)`](http://man7.org/linux/man-pages/man2/rename.2.html) documentation for more details.
555
797
  * @since v0.1.21
556
798
  */
557
- export function renameSync(oldPath: PathLike, newPath: PathLike): void;
799
+ function renameSync(oldPath: PathLike, newPath: PathLike): void;
558
800
  /**
559
801
  * Truncates the file. No arguments other than a possible exception are
560
802
  * given to the completion callback. A file descriptor can also be passed as the
@@ -576,13 +818,13 @@ declare module "_not-use-node-type_fs" {
576
818
  * @since v0.8.6
577
819
  * @param [len=0]
578
820
  */
579
- export function truncate(path: PathLike, len: number | undefined, callback: NoParamCallback): void;
821
+ function truncate(path: PathLike, len: number | undefined, callback: NoParamCallback): void;
580
822
  /**
581
823
  * Asynchronous truncate(2) - Truncate a file to a specified length.
582
824
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
583
825
  */
584
- export function truncate(path: PathLike, callback: NoParamCallback): void;
585
- export namespace truncate {
826
+ function truncate(path: PathLike, callback: NoParamCallback): void;
827
+ namespace truncate {
586
828
  /**
587
829
  * Asynchronous truncate(2) - Truncate a file to a specified length.
588
830
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -599,7 +841,7 @@ declare module "_not-use-node-type_fs" {
599
841
  * @since v0.8.6
600
842
  * @param [len=0]
601
843
  */
602
- export function truncateSync(path: PathLike, len?: number): void;
844
+ function truncateSync(path: PathLike, len?: number): void;
603
845
  /**
604
846
  * Truncates the file descriptor. No arguments other than a possible exception are
605
847
  * given to the completion callback.
@@ -643,13 +885,13 @@ declare module "_not-use-node-type_fs" {
643
885
  * @since v0.8.6
644
886
  * @param [len=0]
645
887
  */
646
- export function ftruncate(fd: number, len: number | undefined, callback: NoParamCallback): void;
888
+ function ftruncate(fd: number, len: number | undefined, callback: NoParamCallback): void;
647
889
  /**
648
890
  * Asynchronous ftruncate(2) - Truncate a file to a specified length.
649
891
  * @param fd A file descriptor.
650
892
  */
651
- export function ftruncate(fd: number, callback: NoParamCallback): void;
652
- export namespace ftruncate {
893
+ function ftruncate(fd: number, callback: NoParamCallback): void;
894
+ namespace ftruncate {
653
895
  /**
654
896
  * Asynchronous ftruncate(2) - Truncate a file to a specified length.
655
897
  * @param fd A file descriptor.
@@ -665,7 +907,7 @@ declare module "_not-use-node-type_fs" {
665
907
  * @since v0.8.6
666
908
  * @param [len=0]
667
909
  */
668
- export function ftruncateSync(fd: number, len?: number): void;
910
+ function ftruncateSync(fd: number, len?: number): void;
669
911
  /**
670
912
  * Asynchronously changes owner and group of a file. No arguments other than a
671
913
  * possible exception are given to the completion callback.
@@ -673,8 +915,8 @@ declare module "_not-use-node-type_fs" {
673
915
  * See the POSIX [`chown(2)`](http://man7.org/linux/man-pages/man2/chown.2.html) documentation for more detail.
674
916
  * @since v0.1.97
675
917
  */
676
- export function chown(path: PathLike, uid: number, gid: number, callback: NoParamCallback): void;
677
- export namespace chown {
918
+ function chown(path: PathLike, uid: number, gid: number, callback: NoParamCallback): void;
919
+ namespace chown {
678
920
  /**
679
921
  * Asynchronous chown(2) - Change ownership of a file.
680
922
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -688,7 +930,7 @@ declare module "_not-use-node-type_fs" {
688
930
  * See the POSIX [`chown(2)`](http://man7.org/linux/man-pages/man2/chown.2.html) documentation for more detail.
689
931
  * @since v0.1.97
690
932
  */
691
- export function chownSync(path: PathLike, uid: number, gid: number): void;
933
+ function chownSync(path: PathLike, uid: number, gid: number): void;
692
934
  /**
693
935
  * Sets the owner of the file. No arguments other than a possible exception are
694
936
  * given to the completion callback.
@@ -696,8 +938,8 @@ declare module "_not-use-node-type_fs" {
696
938
  * See the POSIX [`fchown(2)`](http://man7.org/linux/man-pages/man2/fchown.2.html) documentation for more detail.
697
939
  * @since v0.4.7
698
940
  */
699
- export function fchown(fd: number, uid: number, gid: number, callback: NoParamCallback): void;
700
- export namespace fchown {
941
+ function fchown(fd: number, uid: number, gid: number, callback: NoParamCallback): void;
942
+ namespace fchown {
701
943
  /**
702
944
  * Asynchronous fchown(2) - Change ownership of a file.
703
945
  * @param fd A file descriptor.
@@ -712,15 +954,15 @@ declare module "_not-use-node-type_fs" {
712
954
  * @param uid The file's new owner's user id.
713
955
  * @param gid The file's new group's group id.
714
956
  */
715
- export function fchownSync(fd: number, uid: number, gid: number): void;
957
+ function fchownSync(fd: number, uid: number, gid: number): void;
716
958
  /**
717
959
  * Set the owner of the symbolic link. No arguments other than a possible
718
960
  * exception are given to the completion callback.
719
961
  *
720
962
  * See the POSIX [`lchown(2)`](http://man7.org/linux/man-pages/man2/lchown.2.html) documentation for more detail.
721
963
  */
722
- export function lchown(path: PathLike, uid: number, gid: number, callback: NoParamCallback): void;
723
- export namespace lchown {
964
+ function lchown(path: PathLike, uid: number, gid: number, callback: NoParamCallback): void;
965
+ namespace lchown {
724
966
  /**
725
967
  * Asynchronous lchown(2) - Change ownership of a file. Does not dereference symbolic links.
726
968
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -734,7 +976,7 @@ declare module "_not-use-node-type_fs" {
734
976
  * @param uid The file's new owner's user id.
735
977
  * @param gid The file's new group's group id.
736
978
  */
737
- export function lchownSync(path: PathLike, uid: number, gid: number): void;
979
+ function lchownSync(path: PathLike, uid: number, gid: number): void;
738
980
  /**
739
981
  * 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
740
982
  * link, then the link is not dereferenced: instead, the timestamps of the
@@ -744,8 +986,8 @@ declare module "_not-use-node-type_fs" {
744
986
  * callback.
745
987
  * @since v14.5.0, v12.19.0
746
988
  */
747
- export function lutimes(path: PathLike, atime: TimeLike, mtime: TimeLike, callback: NoParamCallback): void;
748
- export namespace lutimes {
989
+ function lutimes(path: PathLike, atime: TimeLike, mtime: TimeLike, callback: NoParamCallback): void;
990
+ namespace lutimes {
749
991
  /**
750
992
  * Changes the access and modification times of a file in the same way as `fsPromises.utimes()`,
751
993
  * with the difference that if the path refers to a symbolic link, then the link is not
@@ -762,7 +1004,7 @@ declare module "_not-use-node-type_fs" {
762
1004
  * the operation fails. This is the synchronous version of {@link lutimes}.
763
1005
  * @since v14.5.0, v12.19.0
764
1006
  */
765
- export function lutimesSync(path: PathLike, atime: TimeLike, mtime: TimeLike): void;
1007
+ function lutimesSync(path: PathLike, atime: TimeLike, mtime: TimeLike): void;
766
1008
  /**
767
1009
  * Asynchronously changes the permissions of a file. No arguments other than a
768
1010
  * possible exception are given to the completion callback.
@@ -779,8 +1021,8 @@ declare module "_not-use-node-type_fs" {
779
1021
  * ```
780
1022
  * @since v0.1.30
781
1023
  */
782
- export function chmod(path: PathLike, mode: Mode, callback: NoParamCallback): void;
783
- export namespace chmod {
1024
+ function chmod(path: PathLike, mode: Mode, callback: NoParamCallback): void;
1025
+ namespace chmod {
784
1026
  /**
785
1027
  * Asynchronous chmod(2) - Change permissions of a file.
786
1028
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -795,7 +1037,7 @@ declare module "_not-use-node-type_fs" {
795
1037
  * See the POSIX [`chmod(2)`](http://man7.org/linux/man-pages/man2/chmod.2.html) documentation for more detail.
796
1038
  * @since v0.6.7
797
1039
  */
798
- export function chmodSync(path: PathLike, mode: Mode): void;
1040
+ function chmodSync(path: PathLike, mode: Mode): void;
799
1041
  /**
800
1042
  * Sets the permissions on the file. No arguments other than a possible exception
801
1043
  * are given to the completion callback.
@@ -803,8 +1045,8 @@ declare module "_not-use-node-type_fs" {
803
1045
  * See the POSIX [`fchmod(2)`](http://man7.org/linux/man-pages/man2/fchmod.2.html) documentation for more detail.
804
1046
  * @since v0.4.7
805
1047
  */
806
- export function fchmod(fd: number, mode: Mode, callback: NoParamCallback): void;
807
- export namespace fchmod {
1048
+ function fchmod(fd: number, mode: Mode, callback: NoParamCallback): void;
1049
+ namespace fchmod {
808
1050
  /**
809
1051
  * Asynchronous fchmod(2) - Change permissions of a file.
810
1052
  * @param fd A file descriptor.
@@ -818,7 +1060,7 @@ declare module "_not-use-node-type_fs" {
818
1060
  * See the POSIX [`fchmod(2)`](http://man7.org/linux/man-pages/man2/fchmod.2.html) documentation for more detail.
819
1061
  * @since v0.4.7
820
1062
  */
821
- export function fchmodSync(fd: number, mode: Mode): void;
1063
+ function fchmodSync(fd: number, mode: Mode): void;
822
1064
  /**
823
1065
  * Changes the permissions on a symbolic link. No arguments other than a possible
824
1066
  * exception are given to the completion callback.
@@ -828,9 +1070,9 @@ declare module "_not-use-node-type_fs" {
828
1070
  * See the POSIX [`lchmod(2)`](https://www.freebsd.org/cgi/man.cgi?query=lchmod&sektion=2) documentation for more detail.
829
1071
  * @deprecated Since v0.4.7
830
1072
  */
831
- export function lchmod(path: PathLike, mode: Mode, callback: NoParamCallback): void;
1073
+ function lchmod(path: PathLike, mode: Mode, callback: NoParamCallback): void;
832
1074
  /** @deprecated */
833
- export namespace lchmod {
1075
+ namespace lchmod {
834
1076
  /**
835
1077
  * Asynchronous lchmod(2) - Change permissions of a file. Does not dereference symbolic links.
836
1078
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -846,7 +1088,7 @@ declare module "_not-use-node-type_fs" {
846
1088
  * See the POSIX [`lchmod(2)`](https://www.freebsd.org/cgi/man.cgi?query=lchmod&sektion=2) documentation for more detail.
847
1089
  * @deprecated Since v0.4.7
848
1090
  */
849
- export function lchmodSync(path: PathLike, mode: Mode): void;
1091
+ function lchmodSync(path: PathLike, mode: Mode): void;
850
1092
  /**
851
1093
  * 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.
852
1094
  *
@@ -932,8 +1174,8 @@ declare module "_not-use-node-type_fs" {
932
1174
  * ```
933
1175
  * @since v0.0.2
934
1176
  */
935
- export function stat(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
936
- export function stat(
1177
+ function stat(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
1178
+ function stat(
937
1179
  path: PathLike,
938
1180
  options:
939
1181
  | (StatOptions & {
@@ -942,19 +1184,19 @@ declare module "_not-use-node-type_fs" {
942
1184
  | undefined,
943
1185
  callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void,
944
1186
  ): void;
945
- export function stat(
1187
+ function stat(
946
1188
  path: PathLike,
947
1189
  options: StatOptions & {
948
1190
  bigint: true;
949
1191
  },
950
1192
  callback: (err: NodeJS.ErrnoException | null, stats: BigIntStats) => void,
951
1193
  ): void;
952
- export function stat(
1194
+ function stat(
953
1195
  path: PathLike,
954
1196
  options: StatOptions | undefined,
955
1197
  callback: (err: NodeJS.ErrnoException | null, stats: Stats | BigIntStats) => void,
956
1198
  ): void;
957
- export namespace stat {
1199
+ namespace stat {
958
1200
  /**
959
1201
  * Asynchronous stat(2) - Get file status.
960
1202
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -973,7 +1215,7 @@ declare module "_not-use-node-type_fs" {
973
1215
  ): Promise<BigIntStats>;
974
1216
  function __promisify__(path: PathLike, options?: StatOptions): Promise<Stats | BigIntStats>;
975
1217
  }
976
- export interface StatSyncFn extends Function {
1218
+ interface StatSyncFn extends Function {
977
1219
  (path: PathLike, options?: undefined): Stats;
978
1220
  (
979
1221
  path: PathLike,
@@ -1014,15 +1256,15 @@ declare module "_not-use-node-type_fs" {
1014
1256
  * Synchronous stat(2) - Get file status.
1015
1257
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1016
1258
  */
1017
- export const statSync: StatSyncFn;
1259
+ const statSync: StatSyncFn;
1018
1260
  /**
1019
1261
  * Invokes the callback with the `fs.Stats` for the file descriptor.
1020
1262
  *
1021
1263
  * See the POSIX [`fstat(2)`](http://man7.org/linux/man-pages/man2/fstat.2.html) documentation for more detail.
1022
1264
  * @since v0.1.95
1023
1265
  */
1024
- export function fstat(fd: number, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
1025
- export function fstat(
1266
+ function fstat(fd: number, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
1267
+ function fstat(
1026
1268
  fd: number,
1027
1269
  options:
1028
1270
  | (StatOptions & {
@@ -1031,19 +1273,19 @@ declare module "_not-use-node-type_fs" {
1031
1273
  | undefined,
1032
1274
  callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void,
1033
1275
  ): void;
1034
- export function fstat(
1276
+ function fstat(
1035
1277
  fd: number,
1036
1278
  options: StatOptions & {
1037
1279
  bigint: true;
1038
1280
  },
1039
1281
  callback: (err: NodeJS.ErrnoException | null, stats: BigIntStats) => void,
1040
1282
  ): void;
1041
- export function fstat(
1283
+ function fstat(
1042
1284
  fd: number,
1043
1285
  options: StatOptions | undefined,
1044
1286
  callback: (err: NodeJS.ErrnoException | null, stats: Stats | BigIntStats) => void,
1045
1287
  ): void;
1046
- export namespace fstat {
1288
+ namespace fstat {
1047
1289
  /**
1048
1290
  * Asynchronous fstat(2) - Get file status.
1049
1291
  * @param fd A file descriptor.
@@ -1068,19 +1310,19 @@ declare module "_not-use-node-type_fs" {
1068
1310
  * See the POSIX [`fstat(2)`](http://man7.org/linux/man-pages/man2/fstat.2.html) documentation for more detail.
1069
1311
  * @since v0.1.95
1070
1312
  */
1071
- export function fstatSync(
1313
+ function fstatSync(
1072
1314
  fd: number,
1073
1315
  options?: StatOptions & {
1074
1316
  bigint?: false | undefined;
1075
1317
  },
1076
1318
  ): Stats;
1077
- export function fstatSync(
1319
+ function fstatSync(
1078
1320
  fd: number,
1079
1321
  options: StatOptions & {
1080
1322
  bigint: true;
1081
1323
  },
1082
1324
  ): BigIntStats;
1083
- export function fstatSync(fd: number, options?: StatOptions): Stats | BigIntStats;
1325
+ function fstatSync(fd: number, options?: StatOptions): Stats | BigIntStats;
1084
1326
  /**
1085
1327
  * Retrieves the `fs.Stats` for the symbolic link referred to by the path.
1086
1328
  * 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
@@ -1089,8 +1331,8 @@ declare module "_not-use-node-type_fs" {
1089
1331
  * See the POSIX [`lstat(2)`](http://man7.org/linux/man-pages/man2/lstat.2.html) documentation for more details.
1090
1332
  * @since v0.1.30
1091
1333
  */
1092
- export function lstat(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
1093
- export function lstat(
1334
+ function lstat(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
1335
+ function lstat(
1094
1336
  path: PathLike,
1095
1337
  options:
1096
1338
  | (StatOptions & {
@@ -1099,19 +1341,19 @@ declare module "_not-use-node-type_fs" {
1099
1341
  | undefined,
1100
1342
  callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void,
1101
1343
  ): void;
1102
- export function lstat(
1344
+ function lstat(
1103
1345
  path: PathLike,
1104
1346
  options: StatOptions & {
1105
1347
  bigint: true;
1106
1348
  },
1107
1349
  callback: (err: NodeJS.ErrnoException | null, stats: BigIntStats) => void,
1108
1350
  ): void;
1109
- export function lstat(
1351
+ function lstat(
1110
1352
  path: PathLike,
1111
1353
  options: StatOptions | undefined,
1112
1354
  callback: (err: NodeJS.ErrnoException | null, stats: Stats | BigIntStats) => void,
1113
1355
  ): void;
1114
- export namespace lstat {
1356
+ namespace lstat {
1115
1357
  /**
1116
1358
  * Asynchronous lstat(2) - Get file status. Does not dereference symbolic links.
1117
1359
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -1138,8 +1380,8 @@ declare module "_not-use-node-type_fs" {
1138
1380
  * @since v19.6.0, v18.15.0
1139
1381
  * @param path A path to an existing file or directory on the file system to be queried.
1140
1382
  */
1141
- export function statfs(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: StatsFs) => void): void;
1142
- export function statfs(
1383
+ function statfs(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: StatsFs) => void): void;
1384
+ function statfs(
1143
1385
  path: PathLike,
1144
1386
  options:
1145
1387
  | (StatFsOptions & {
@@ -1148,19 +1390,19 @@ declare module "_not-use-node-type_fs" {
1148
1390
  | undefined,
1149
1391
  callback: (err: NodeJS.ErrnoException | null, stats: StatsFs) => void,
1150
1392
  ): void;
1151
- export function statfs(
1393
+ function statfs(
1152
1394
  path: PathLike,
1153
1395
  options: StatFsOptions & {
1154
1396
  bigint: true;
1155
1397
  },
1156
1398
  callback: (err: NodeJS.ErrnoException | null, stats: BigIntStatsFs) => void,
1157
1399
  ): void;
1158
- export function statfs(
1400
+ function statfs(
1159
1401
  path: PathLike,
1160
1402
  options: StatFsOptions | undefined,
1161
1403
  callback: (err: NodeJS.ErrnoException | null, stats: StatsFs | BigIntStatsFs) => void,
1162
1404
  ): void;
1163
- export namespace statfs {
1405
+ namespace statfs {
1164
1406
  /**
1165
1407
  * 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.
1166
1408
  * @param path A path to an existing file or directory on the file system to be queried.
@@ -1187,32 +1429,32 @@ declare module "_not-use-node-type_fs" {
1187
1429
  * @since v19.6.0, v18.15.0
1188
1430
  * @param path A path to an existing file or directory on the file system to be queried.
1189
1431
  */
1190
- export function statfsSync(
1432
+ function statfsSync(
1191
1433
  path: PathLike,
1192
1434
  options?: StatFsOptions & {
1193
1435
  bigint?: false | undefined;
1194
1436
  },
1195
1437
  ): StatsFs;
1196
- export function statfsSync(
1438
+ function statfsSync(
1197
1439
  path: PathLike,
1198
1440
  options: StatFsOptions & {
1199
1441
  bigint: true;
1200
1442
  },
1201
1443
  ): BigIntStatsFs;
1202
- export function statfsSync(path: PathLike, options?: StatFsOptions): StatsFs | BigIntStatsFs;
1444
+ function statfsSync(path: PathLike, options?: StatFsOptions): StatsFs | BigIntStatsFs;
1203
1445
  /**
1204
1446
  * Synchronous lstat(2) - Get file status. Does not dereference symbolic links.
1205
1447
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1206
1448
  */
1207
- export const lstatSync: StatSyncFn;
1449
+ const lstatSync: StatSyncFn;
1208
1450
  /**
1209
1451
  * 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
1210
1452
  * a possible
1211
1453
  * exception are given to the completion callback.
1212
1454
  * @since v0.1.31
1213
1455
  */
1214
- export function link(existingPath: PathLike, newPath: PathLike, callback: NoParamCallback): void;
1215
- export namespace link {
1456
+ function link(existingPath: PathLike, newPath: PathLike, callback: NoParamCallback): void;
1457
+ namespace link {
1216
1458
  /**
1217
1459
  * Asynchronous link(2) - Create a new link (also known as a hard link) to an existing file.
1218
1460
  * @param existingPath A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -1224,7 +1466,7 @@ declare module "_not-use-node-type_fs" {
1224
1466
  * 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`.
1225
1467
  * @since v0.1.31
1226
1468
  */
1227
- export function linkSync(existingPath: PathLike, newPath: PathLike): void;
1469
+ function linkSync(existingPath: PathLike, newPath: PathLike): void;
1228
1470
  /**
1229
1471
  * Creates the link called `path` pointing to `target`. No arguments other than a
1230
1472
  * possible exception are given to the completion callback.
@@ -1258,7 +1500,7 @@ declare module "_not-use-node-type_fs" {
1258
1500
  * @since v0.1.31
1259
1501
  * @param [type='null']
1260
1502
  */
1261
- export function symlink(
1503
+ function symlink(
1262
1504
  target: PathLike,
1263
1505
  path: PathLike,
1264
1506
  type: symlink.Type | undefined | null,
@@ -1269,8 +1511,8 @@ declare module "_not-use-node-type_fs" {
1269
1511
  * @param target A path to an existing file. If a URL is provided, it must use the `file:` protocol.
1270
1512
  * @param path A path to the new symlink. If a URL is provided, it must use the `file:` protocol.
1271
1513
  */
1272
- export function symlink(target: PathLike, path: PathLike, callback: NoParamCallback): void;
1273
- export namespace symlink {
1514
+ function symlink(target: PathLike, path: PathLike, callback: NoParamCallback): void;
1515
+ namespace symlink {
1274
1516
  /**
1275
1517
  * Asynchronous symlink(2) - Create a new symbolic link to an existing file.
1276
1518
  * @param target A path to an existing file. If a URL is provided, it must use the `file:` protocol.
@@ -1289,7 +1531,7 @@ declare module "_not-use-node-type_fs" {
1289
1531
  * @since v0.1.31
1290
1532
  * @param [type='null']
1291
1533
  */
1292
- export function symlinkSync(target: PathLike, path: PathLike, type?: symlink.Type | null): void;
1534
+ function symlinkSync(target: PathLike, path: PathLike, type?: symlink.Type | null): void;
1293
1535
  /**
1294
1536
  * Reads the contents of the symbolic link referred to by `path`. The callback gets
1295
1537
  * two arguments `(err, linkString)`.
@@ -1302,7 +1544,7 @@ declare module "_not-use-node-type_fs" {
1302
1544
  * the link path returned will be passed as a `Buffer` object.
1303
1545
  * @since v0.1.31
1304
1546
  */
1305
- export function readlink(
1547
+ function readlink(
1306
1548
  path: PathLike,
1307
1549
  options: EncodingOption,
1308
1550
  callback: (err: NodeJS.ErrnoException | null, linkString: string) => void,
@@ -1312,30 +1554,30 @@ declare module "_not-use-node-type_fs" {
1312
1554
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1313
1555
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1314
1556
  */
1315
- export function readlink(
1557
+ function readlink(
1316
1558
  path: PathLike,
1317
1559
  options: BufferEncodingOption,
1318
- callback: (err: NodeJS.ErrnoException | null, linkString: Buffer) => void,
1560
+ callback: (err: NodeJS.ErrnoException | null, linkString: NonSharedBuffer) => void,
1319
1561
  ): void;
1320
1562
  /**
1321
1563
  * Asynchronous readlink(2) - read value of a symbolic link.
1322
1564
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1323
1565
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1324
1566
  */
1325
- export function readlink(
1567
+ function readlink(
1326
1568
  path: PathLike,
1327
1569
  options: EncodingOption,
1328
- callback: (err: NodeJS.ErrnoException | null, linkString: string | Buffer) => void,
1570
+ callback: (err: NodeJS.ErrnoException | null, linkString: string | NonSharedBuffer) => void,
1329
1571
  ): void;
1330
1572
  /**
1331
1573
  * Asynchronous readlink(2) - read value of a symbolic link.
1332
1574
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1333
1575
  */
1334
- export function readlink(
1576
+ function readlink(
1335
1577
  path: PathLike,
1336
1578
  callback: (err: NodeJS.ErrnoException | null, linkString: string) => void,
1337
1579
  ): void;
1338
- export namespace readlink {
1580
+ namespace readlink {
1339
1581
  /**
1340
1582
  * Asynchronous readlink(2) - read value of a symbolic link.
1341
1583
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -1347,13 +1589,13 @@ declare module "_not-use-node-type_fs" {
1347
1589
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1348
1590
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1349
1591
  */
1350
- function __promisify__(path: PathLike, options: BufferEncodingOption): Promise<Buffer>;
1592
+ function __promisify__(path: PathLike, options: BufferEncodingOption): Promise<NonSharedBuffer>;
1351
1593
  /**
1352
1594
  * Asynchronous readlink(2) - read value of a symbolic link.
1353
1595
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1354
1596
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1355
1597
  */
1356
- function __promisify__(path: PathLike, options?: EncodingOption): Promise<string | Buffer>;
1598
+ function __promisify__(path: PathLike, options?: EncodingOption): Promise<string | NonSharedBuffer>;
1357
1599
  }
1358
1600
  /**
1359
1601
  * Returns the symbolic link's string value.
@@ -1366,19 +1608,19 @@ declare module "_not-use-node-type_fs" {
1366
1608
  * the link path returned will be passed as a `Buffer` object.
1367
1609
  * @since v0.1.31
1368
1610
  */
1369
- export function readlinkSync(path: PathLike, options?: EncodingOption): string;
1611
+ function readlinkSync(path: PathLike, options?: EncodingOption): string;
1370
1612
  /**
1371
1613
  * Synchronous readlink(2) - read value of a symbolic link.
1372
1614
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1373
1615
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1374
1616
  */
1375
- export function readlinkSync(path: PathLike, options: BufferEncodingOption): Buffer;
1617
+ function readlinkSync(path: PathLike, options: BufferEncodingOption): NonSharedBuffer;
1376
1618
  /**
1377
1619
  * Synchronous readlink(2) - read value of a symbolic link.
1378
1620
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1379
1621
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1380
1622
  */
1381
- export function readlinkSync(path: PathLike, options?: EncodingOption): string | Buffer;
1623
+ function readlinkSync(path: PathLike, options?: EncodingOption): string | NonSharedBuffer;
1382
1624
  /**
1383
1625
  * Asynchronously computes the canonical pathname by resolving `.`, `..`, and
1384
1626
  * symbolic links.
@@ -1405,7 +1647,7 @@ declare module "_not-use-node-type_fs" {
1405
1647
  * dependent name for that object.
1406
1648
  * @since v0.1.31
1407
1649
  */
1408
- export function realpath(
1650
+ function realpath(
1409
1651
  path: PathLike,
1410
1652
  options: EncodingOption,
1411
1653
  callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void,
@@ -1415,30 +1657,30 @@ declare module "_not-use-node-type_fs" {
1415
1657
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1416
1658
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1417
1659
  */
1418
- export function realpath(
1660
+ function realpath(
1419
1661
  path: PathLike,
1420
1662
  options: BufferEncodingOption,
1421
- callback: (err: NodeJS.ErrnoException | null, resolvedPath: Buffer) => void,
1663
+ callback: (err: NodeJS.ErrnoException | null, resolvedPath: NonSharedBuffer) => void,
1422
1664
  ): void;
1423
1665
  /**
1424
1666
  * Asynchronous realpath(3) - return the canonicalized absolute pathname.
1425
1667
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1426
1668
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1427
1669
  */
1428
- export function realpath(
1670
+ function realpath(
1429
1671
  path: PathLike,
1430
1672
  options: EncodingOption,
1431
- callback: (err: NodeJS.ErrnoException | null, resolvedPath: string | Buffer) => void,
1673
+ callback: (err: NodeJS.ErrnoException | null, resolvedPath: string | NonSharedBuffer) => void,
1432
1674
  ): void;
1433
1675
  /**
1434
1676
  * Asynchronous realpath(3) - return the canonicalized absolute pathname.
1435
1677
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1436
1678
  */
1437
- export function realpath(
1679
+ function realpath(
1438
1680
  path: PathLike,
1439
1681
  callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void,
1440
1682
  ): void;
1441
- export namespace realpath {
1683
+ namespace realpath {
1442
1684
  /**
1443
1685
  * Asynchronous realpath(3) - return the canonicalized absolute pathname.
1444
1686
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -1450,13 +1692,13 @@ declare module "_not-use-node-type_fs" {
1450
1692
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1451
1693
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1452
1694
  */
1453
- function __promisify__(path: PathLike, options: BufferEncodingOption): Promise<Buffer>;
1695
+ function __promisify__(path: PathLike, options: BufferEncodingOption): Promise<NonSharedBuffer>;
1454
1696
  /**
1455
1697
  * Asynchronous realpath(3) - return the canonicalized absolute pathname.
1456
1698
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1457
1699
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1458
1700
  */
1459
- function __promisify__(path: PathLike, options?: EncodingOption): Promise<string | Buffer>;
1701
+ function __promisify__(path: PathLike, options?: EncodingOption): Promise<string | NonSharedBuffer>;
1460
1702
  /**
1461
1703
  * Asynchronous [`realpath(3)`](http://man7.org/linux/man-pages/man3/realpath.3.html).
1462
1704
  *
@@ -1482,12 +1724,12 @@ declare module "_not-use-node-type_fs" {
1482
1724
  function native(
1483
1725
  path: PathLike,
1484
1726
  options: BufferEncodingOption,
1485
- callback: (err: NodeJS.ErrnoException | null, resolvedPath: Buffer) => void,
1727
+ callback: (err: NodeJS.ErrnoException | null, resolvedPath: NonSharedBuffer) => void,
1486
1728
  ): void;
1487
1729
  function native(
1488
1730
  path: PathLike,
1489
1731
  options: EncodingOption,
1490
- callback: (err: NodeJS.ErrnoException | null, resolvedPath: string | Buffer) => void,
1732
+ callback: (err: NodeJS.ErrnoException | null, resolvedPath: string | NonSharedBuffer) => void,
1491
1733
  ): void;
1492
1734
  function native(
1493
1735
  path: PathLike,
@@ -1501,23 +1743,23 @@ declare module "_not-use-node-type_fs" {
1501
1743
  * this API: {@link realpath}.
1502
1744
  * @since v0.1.31
1503
1745
  */
1504
- export function realpathSync(path: PathLike, options?: EncodingOption): string;
1746
+ function realpathSync(path: PathLike, options?: EncodingOption): string;
1505
1747
  /**
1506
1748
  * Synchronous realpath(3) - return the canonicalized absolute pathname.
1507
1749
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1508
1750
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1509
1751
  */
1510
- export function realpathSync(path: PathLike, options: BufferEncodingOption): Buffer;
1752
+ function realpathSync(path: PathLike, options: BufferEncodingOption): NonSharedBuffer;
1511
1753
  /**
1512
1754
  * Synchronous realpath(3) - return the canonicalized absolute pathname.
1513
1755
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1514
1756
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1515
1757
  */
1516
- export function realpathSync(path: PathLike, options?: EncodingOption): string | Buffer;
1517
- export namespace realpathSync {
1758
+ function realpathSync(path: PathLike, options?: EncodingOption): string | NonSharedBuffer;
1759
+ namespace realpathSync {
1518
1760
  function native(path: PathLike, options?: EncodingOption): string;
1519
- function native(path: PathLike, options: BufferEncodingOption): Buffer;
1520
- function native(path: PathLike, options?: EncodingOption): string | Buffer;
1761
+ function native(path: PathLike, options: BufferEncodingOption): NonSharedBuffer;
1762
+ function native(path: PathLike, options?: EncodingOption): string | NonSharedBuffer;
1521
1763
  }
1522
1764
  /**
1523
1765
  * Asynchronously removes a file or symbolic link. No arguments other than a
@@ -1538,8 +1780,8 @@ declare module "_not-use-node-type_fs" {
1538
1780
  * See the POSIX [`unlink(2)`](http://man7.org/linux/man-pages/man2/unlink.2.html) documentation for more details.
1539
1781
  * @since v0.0.2
1540
1782
  */
1541
- export function unlink(path: PathLike, callback: NoParamCallback): void;
1542
- export namespace unlink {
1783
+ function unlink(path: PathLike, callback: NoParamCallback): void;
1784
+ namespace unlink {
1543
1785
  /**
1544
1786
  * Asynchronous unlink(2) - delete a name and possibly the file it refers to.
1545
1787
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -1550,34 +1792,10 @@ declare module "_not-use-node-type_fs" {
1550
1792
  * Synchronous [`unlink(2)`](http://man7.org/linux/man-pages/man2/unlink.2.html). Returns `undefined`.
1551
1793
  * @since v0.1.21
1552
1794
  */
1553
- export function unlinkSync(path: PathLike): void;
1554
- export interface RmDirOptions {
1555
- /**
1556
- * If an `EBUSY`, `EMFILE`, `ENFILE`, `ENOTEMPTY`, or
1557
- * `EPERM` error is encountered, Node.js will retry the operation with a linear
1558
- * backoff wait of `retryDelay` ms longer on each try. This option represents the
1559
- * number of retries. This option is ignored if the `recursive` option is not
1560
- * `true`.
1561
- * @default 0
1562
- */
1563
- maxRetries?: number | undefined;
1564
- /**
1565
- * @deprecated since v14.14.0 In future versions of Node.js and will trigger a warning
1566
- * `fs.rmdir(path, { recursive: true })` will throw if `path` does not exist or is a file.
1567
- * Use `fs.rm(path, { recursive: true, force: true })` instead.
1568
- *
1569
- * If `true`, perform a recursive directory removal. In
1570
- * recursive mode, operations are retried on failure.
1571
- * @default false
1572
- */
1573
- recursive?: boolean | undefined;
1574
- /**
1575
- * The amount of time in milliseconds to wait between retries.
1576
- * This option is ignored if the `recursive` option is not `true`.
1577
- * @default 100
1578
- */
1579
- retryDelay?: number | undefined;
1580
- }
1795
+ function unlinkSync(path: PathLike): void;
1796
+ /** @deprecated `rmdir()` no longer provides any options. This interface will be removed in a future version. */
1797
+ // TODO: remove in future major
1798
+ interface RmDirOptions {}
1581
1799
  /**
1582
1800
  * Asynchronous [`rmdir(2)`](http://man7.org/linux/man-pages/man2/rmdir.2.html). No arguments other than a possible exception are given
1583
1801
  * to the completion callback.
@@ -1588,14 +1806,13 @@ declare module "_not-use-node-type_fs" {
1588
1806
  * To get a behavior similar to the `rm -rf` Unix command, use {@link rm} with options `{ recursive: true, force: true }`.
1589
1807
  * @since v0.0.2
1590
1808
  */
1591
- export function rmdir(path: PathLike, callback: NoParamCallback): void;
1592
- export function rmdir(path: PathLike, options: RmDirOptions, callback: NoParamCallback): void;
1593
- export namespace rmdir {
1809
+ function rmdir(path: PathLike, callback: NoParamCallback): void;
1810
+ namespace rmdir {
1594
1811
  /**
1595
1812
  * Asynchronous rmdir(2) - delete a directory.
1596
1813
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1597
1814
  */
1598
- function __promisify__(path: PathLike, options?: RmDirOptions): Promise<void>;
1815
+ function __promisify__(path: PathLike): Promise<void>;
1599
1816
  }
1600
1817
  /**
1601
1818
  * Synchronous [`rmdir(2)`](http://man7.org/linux/man-pages/man2/rmdir.2.html). Returns `undefined`.
@@ -1606,8 +1823,8 @@ declare module "_not-use-node-type_fs" {
1606
1823
  * To get a behavior similar to the `rm -rf` Unix command, use {@link rmSync} with options `{ recursive: true, force: true }`.
1607
1824
  * @since v0.1.21
1608
1825
  */
1609
- export function rmdirSync(path: PathLike, options?: RmDirOptions): void;
1610
- export interface RmOptions {
1826
+ function rmdirSync(path: PathLike): void;
1827
+ interface RmOptions {
1611
1828
  /**
1612
1829
  * When `true`, exceptions will be ignored if `path` does not exist.
1613
1830
  * @default false
@@ -1640,9 +1857,9 @@ declare module "_not-use-node-type_fs" {
1640
1857
  * completion callback.
1641
1858
  * @since v14.14.0
1642
1859
  */
1643
- export function rm(path: PathLike, callback: NoParamCallback): void;
1644
- export function rm(path: PathLike, options: RmOptions, callback: NoParamCallback): void;
1645
- export namespace rm {
1860
+ function rm(path: PathLike, callback: NoParamCallback): void;
1861
+ function rm(path: PathLike, options: RmOptions, callback: NoParamCallback): void;
1862
+ namespace rm {
1646
1863
  /**
1647
1864
  * Asynchronously removes files and directories (modeled on the standard POSIX `rm` utility).
1648
1865
  */
@@ -1652,8 +1869,8 @@ declare module "_not-use-node-type_fs" {
1652
1869
  * Synchronously removes files and directories (modeled on the standard POSIX `rm` utility). Returns `undefined`.
1653
1870
  * @since v14.14.0
1654
1871
  */
1655
- export function rmSync(path: PathLike, options?: RmOptions): void;
1656
- export interface MakeDirectoryOptions {
1872
+ function rmSync(path: PathLike, options?: RmOptions): void;
1873
+ interface MakeDirectoryOptions {
1657
1874
  /**
1658
1875
  * Indicates whether parent folders should be created.
1659
1876
  * If a folder was created, the path to the first created folder will be returned.
@@ -1702,7 +1919,7 @@ declare module "_not-use-node-type_fs" {
1702
1919
  * See the POSIX [`mkdir(2)`](http://man7.org/linux/man-pages/man2/mkdir.2.html) documentation for more details.
1703
1920
  * @since v0.1.8
1704
1921
  */
1705
- export function mkdir(
1922
+ function mkdir(
1706
1923
  path: PathLike,
1707
1924
  options: MakeDirectoryOptions & {
1708
1925
  recursive: true;
@@ -1715,7 +1932,7 @@ declare module "_not-use-node-type_fs" {
1715
1932
  * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
1716
1933
  * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
1717
1934
  */
1718
- export function mkdir(
1935
+ function mkdir(
1719
1936
  path: PathLike,
1720
1937
  options:
1721
1938
  | Mode
@@ -1732,7 +1949,7 @@ declare module "_not-use-node-type_fs" {
1732
1949
  * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
1733
1950
  * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
1734
1951
  */
1735
- export function mkdir(
1952
+ function mkdir(
1736
1953
  path: PathLike,
1737
1954
  options: Mode | MakeDirectoryOptions | null | undefined,
1738
1955
  callback: (err: NodeJS.ErrnoException | null, path?: string) => void,
@@ -1741,8 +1958,8 @@ declare module "_not-use-node-type_fs" {
1741
1958
  * Asynchronous mkdir(2) - create a directory with a mode of `0o777`.
1742
1959
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1743
1960
  */
1744
- export function mkdir(path: PathLike, callback: NoParamCallback): void;
1745
- export namespace mkdir {
1961
+ function mkdir(path: PathLike, callback: NoParamCallback): void;
1962
+ namespace mkdir {
1746
1963
  /**
1747
1964
  * Asynchronous mkdir(2) - create a directory.
1748
1965
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -1788,7 +2005,7 @@ declare module "_not-use-node-type_fs" {
1788
2005
  * See the POSIX [`mkdir(2)`](http://man7.org/linux/man-pages/man2/mkdir.2.html) documentation for more details.
1789
2006
  * @since v0.1.21
1790
2007
  */
1791
- export function mkdirSync(
2008
+ function mkdirSync(
1792
2009
  path: PathLike,
1793
2010
  options: MakeDirectoryOptions & {
1794
2011
  recursive: true;
@@ -1800,7 +2017,7 @@ declare module "_not-use-node-type_fs" {
1800
2017
  * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
1801
2018
  * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
1802
2019
  */
1803
- export function mkdirSync(
2020
+ function mkdirSync(
1804
2021
  path: PathLike,
1805
2022
  options?:
1806
2023
  | Mode
@@ -1815,7 +2032,7 @@ declare module "_not-use-node-type_fs" {
1815
2032
  * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
1816
2033
  * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
1817
2034
  */
1818
- export function mkdirSync(path: PathLike, options?: Mode | MakeDirectoryOptions | null): string | undefined;
2035
+ function mkdirSync(path: PathLike, options?: Mode | MakeDirectoryOptions | null): string | undefined;
1819
2036
  /**
1820
2037
  * Creates a unique temporary directory.
1821
2038
  *
@@ -1875,7 +2092,7 @@ declare module "_not-use-node-type_fs" {
1875
2092
  * ```
1876
2093
  * @since v5.10.0
1877
2094
  */
1878
- export function mkdtemp(
2095
+ function mkdtemp(
1879
2096
  prefix: string,
1880
2097
  options: EncodingOption,
1881
2098
  callback: (err: NodeJS.ErrnoException | null, folder: string) => void,
@@ -1885,34 +2102,30 @@ declare module "_not-use-node-type_fs" {
1885
2102
  * Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
1886
2103
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1887
2104
  */
1888
- export function mkdtemp(
2105
+ function mkdtemp(
1889
2106
  prefix: string,
1890
- options:
1891
- | "buffer"
1892
- | {
1893
- encoding: "buffer";
1894
- },
1895
- callback: (err: NodeJS.ErrnoException | null, folder: Buffer) => void,
2107
+ options: BufferEncodingOption,
2108
+ callback: (err: NodeJS.ErrnoException | null, folder: NonSharedBuffer) => void,
1896
2109
  ): void;
1897
2110
  /**
1898
2111
  * Asynchronously creates a unique temporary directory.
1899
2112
  * Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
1900
2113
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1901
2114
  */
1902
- export function mkdtemp(
2115
+ function mkdtemp(
1903
2116
  prefix: string,
1904
2117
  options: EncodingOption,
1905
- callback: (err: NodeJS.ErrnoException | null, folder: string | Buffer) => void,
2118
+ callback: (err: NodeJS.ErrnoException | null, folder: string | NonSharedBuffer) => void,
1906
2119
  ): void;
1907
2120
  /**
1908
2121
  * Asynchronously creates a unique temporary directory.
1909
2122
  * Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
1910
2123
  */
1911
- export function mkdtemp(
2124
+ function mkdtemp(
1912
2125
  prefix: string,
1913
2126
  callback: (err: NodeJS.ErrnoException | null, folder: string) => void,
1914
2127
  ): void;
1915
- export namespace mkdtemp {
2128
+ namespace mkdtemp {
1916
2129
  /**
1917
2130
  * Asynchronously creates a unique temporary directory.
1918
2131
  * Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
@@ -1924,13 +2137,13 @@ declare module "_not-use-node-type_fs" {
1924
2137
  * Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
1925
2138
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1926
2139
  */
1927
- function __promisify__(prefix: string, options: BufferEncodingOption): Promise<Buffer>;
2140
+ function __promisify__(prefix: string, options: BufferEncodingOption): Promise<NonSharedBuffer>;
1928
2141
  /**
1929
2142
  * Asynchronously creates a unique temporary directory.
1930
2143
  * Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
1931
2144
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1932
2145
  */
1933
- function __promisify__(prefix: string, options?: EncodingOption): Promise<string | Buffer>;
2146
+ function __promisify__(prefix: string, options?: EncodingOption): Promise<string | NonSharedBuffer>;
1934
2147
  }
1935
2148
  /**
1936
2149
  * Returns the created directory path.
@@ -1942,19 +2155,52 @@ declare module "_not-use-node-type_fs" {
1942
2155
  * object with an `encoding` property specifying the character encoding to use.
1943
2156
  * @since v5.10.0
1944
2157
  */
1945
- export function mkdtempSync(prefix: string, options?: EncodingOption): string;
2158
+ function mkdtempSync(prefix: string, options?: EncodingOption): string;
1946
2159
  /**
1947
2160
  * Synchronously creates a unique temporary directory.
1948
2161
  * Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
1949
2162
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1950
2163
  */
1951
- export function mkdtempSync(prefix: string, options: BufferEncodingOption): Buffer;
2164
+ function mkdtempSync(prefix: string, options: BufferEncodingOption): NonSharedBuffer;
1952
2165
  /**
1953
2166
  * Synchronously creates a unique temporary directory.
1954
2167
  * Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
1955
2168
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1956
2169
  */
1957
- export function mkdtempSync(prefix: string, options?: EncodingOption): string | Buffer;
2170
+ function mkdtempSync(prefix: string, options?: EncodingOption): string | NonSharedBuffer;
2171
+ interface DisposableTempDir extends Disposable {
2172
+ /**
2173
+ * The path of the created directory.
2174
+ */
2175
+ path: string;
2176
+ /**
2177
+ * A function which removes the created directory.
2178
+ */
2179
+ remove(): void;
2180
+ /**
2181
+ * The same as `remove`.
2182
+ */
2183
+ [Symbol.dispose](): void;
2184
+ }
2185
+ /**
2186
+ * Returns a disposable object whose `path` property holds the created directory
2187
+ * path. When the object is disposed, the directory and its contents will be
2188
+ * removed if it still exists. If the directory cannot be deleted, disposal will
2189
+ * throw an error. The object has a `remove()` method which will perform the same
2190
+ * task.
2191
+ *
2192
+ * <!-- TODO: link MDN docs for disposables once https://github.com/mdn/content/pull/38027 lands -->
2193
+ *
2194
+ * For detailed information, see the documentation of `fs.mkdtemp()`.
2195
+ *
2196
+ * There is no callback-based version of this API because it is designed for use
2197
+ * with the `using` syntax.
2198
+ *
2199
+ * The optional `options` argument can be a string specifying an encoding, or an
2200
+ * object with an `encoding` property specifying the character encoding to use.
2201
+ * @since v24.4.0
2202
+ */
2203
+ function mkdtempDisposableSync(prefix: string, options?: EncodingOption): DisposableTempDir;
1958
2204
  /**
1959
2205
  * 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 `'..'`.
1960
2206
  *
@@ -1968,7 +2214,7 @@ declare module "_not-use-node-type_fs" {
1968
2214
  * If `options.withFileTypes` is set to `true`, the `files` array will contain `fs.Dirent` objects.
1969
2215
  * @since v0.1.8
1970
2216
  */
1971
- export function readdir(
2217
+ function readdir(
1972
2218
  path: PathLike,
1973
2219
  options:
1974
2220
  | {
@@ -1986,7 +2232,7 @@ declare module "_not-use-node-type_fs" {
1986
2232
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1987
2233
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
1988
2234
  */
1989
- export function readdir(
2235
+ function readdir(
1990
2236
  path: PathLike,
1991
2237
  options:
1992
2238
  | {
@@ -1995,14 +2241,14 @@ declare module "_not-use-node-type_fs" {
1995
2241
  recursive?: boolean | undefined;
1996
2242
  }
1997
2243
  | "buffer",
1998
- callback: (err: NodeJS.ErrnoException | null, files: Buffer[]) => void,
2244
+ callback: (err: NodeJS.ErrnoException | null, files: NonSharedBuffer[]) => void,
1999
2245
  ): void;
2000
2246
  /**
2001
2247
  * Asynchronous readdir(3) - read a directory.
2002
2248
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2003
2249
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
2004
2250
  */
2005
- export function readdir(
2251
+ function readdir(
2006
2252
  path: PathLike,
2007
2253
  options:
2008
2254
  | (ObjectEncodingOptions & {
@@ -2012,13 +2258,13 @@ declare module "_not-use-node-type_fs" {
2012
2258
  | BufferEncoding
2013
2259
  | undefined
2014
2260
  | null,
2015
- callback: (err: NodeJS.ErrnoException | null, files: string[] | Buffer[]) => void,
2261
+ callback: (err: NodeJS.ErrnoException | null, files: string[] | NonSharedBuffer[]) => void,
2016
2262
  ): void;
2017
2263
  /**
2018
2264
  * Asynchronous readdir(3) - read a directory.
2019
2265
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2020
2266
  */
2021
- export function readdir(
2267
+ function readdir(
2022
2268
  path: PathLike,
2023
2269
  callback: (err: NodeJS.ErrnoException | null, files: string[]) => void,
2024
2270
  ): void;
@@ -2027,7 +2273,7 @@ declare module "_not-use-node-type_fs" {
2027
2273
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2028
2274
  * @param options If called with `withFileTypes: true` the result data will be an array of Dirent.
2029
2275
  */
2030
- export function readdir(
2276
+ function readdir(
2031
2277
  path: PathLike,
2032
2278
  options: ObjectEncodingOptions & {
2033
2279
  withFileTypes: true;
@@ -2040,16 +2286,16 @@ declare module "_not-use-node-type_fs" {
2040
2286
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2041
2287
  * @param options Must include `withFileTypes: true` and `encoding: 'buffer'`.
2042
2288
  */
2043
- export function readdir(
2289
+ function readdir(
2044
2290
  path: PathLike,
2045
2291
  options: {
2046
2292
  encoding: "buffer";
2047
2293
  withFileTypes: true;
2048
2294
  recursive?: boolean | undefined;
2049
2295
  },
2050
- callback: (err: NodeJS.ErrnoException | null, files: Dirent<Buffer>[]) => void,
2296
+ callback: (err: NodeJS.ErrnoException | null, files: Dirent<NonSharedBuffer>[]) => void,
2051
2297
  ): void;
2052
- export namespace readdir {
2298
+ namespace readdir {
2053
2299
  /**
2054
2300
  * Asynchronous readdir(3) - read a directory.
2055
2301
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -2080,7 +2326,7 @@ declare module "_not-use-node-type_fs" {
2080
2326
  withFileTypes?: false | undefined;
2081
2327
  recursive?: boolean | undefined;
2082
2328
  },
2083
- ): Promise<Buffer[]>;
2329
+ ): Promise<NonSharedBuffer[]>;
2084
2330
  /**
2085
2331
  * Asynchronous readdir(3) - read a directory.
2086
2332
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -2095,7 +2341,7 @@ declare module "_not-use-node-type_fs" {
2095
2341
  })
2096
2342
  | BufferEncoding
2097
2343
  | null,
2098
- ): Promise<string[] | Buffer[]>;
2344
+ ): Promise<string[] | NonSharedBuffer[]>;
2099
2345
  /**
2100
2346
  * Asynchronous readdir(3) - read a directory.
2101
2347
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -2120,7 +2366,7 @@ declare module "_not-use-node-type_fs" {
2120
2366
  withFileTypes: true;
2121
2367
  recursive?: boolean | undefined;
2122
2368
  },
2123
- ): Promise<Dirent<Buffer>[]>;
2369
+ ): Promise<Dirent<NonSharedBuffer>[]>;
2124
2370
  }
2125
2371
  /**
2126
2372
  * Reads the contents of the directory.
@@ -2135,7 +2381,7 @@ declare module "_not-use-node-type_fs" {
2135
2381
  * If `options.withFileTypes` is set to `true`, the result will contain `fs.Dirent` objects.
2136
2382
  * @since v0.1.21
2137
2383
  */
2138
- export function readdirSync(
2384
+ function readdirSync(
2139
2385
  path: PathLike,
2140
2386
  options?:
2141
2387
  | {
@@ -2151,7 +2397,7 @@ declare module "_not-use-node-type_fs" {
2151
2397
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2152
2398
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
2153
2399
  */
2154
- export function readdirSync(
2400
+ function readdirSync(
2155
2401
  path: PathLike,
2156
2402
  options:
2157
2403
  | {
@@ -2160,13 +2406,13 @@ declare module "_not-use-node-type_fs" {
2160
2406
  recursive?: boolean | undefined;
2161
2407
  }
2162
2408
  | "buffer",
2163
- ): Buffer[];
2409
+ ): NonSharedBuffer[];
2164
2410
  /**
2165
2411
  * Synchronous readdir(3) - read a directory.
2166
2412
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2167
2413
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
2168
2414
  */
2169
- export function readdirSync(
2415
+ function readdirSync(
2170
2416
  path: PathLike,
2171
2417
  options?:
2172
2418
  | (ObjectEncodingOptions & {
@@ -2175,13 +2421,13 @@ declare module "_not-use-node-type_fs" {
2175
2421
  })
2176
2422
  | BufferEncoding
2177
2423
  | null,
2178
- ): string[] | Buffer[];
2424
+ ): string[] | NonSharedBuffer[];
2179
2425
  /**
2180
2426
  * Synchronous readdir(3) - read a directory.
2181
2427
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2182
2428
  * @param options If called with `withFileTypes: true` the result data will be an array of Dirent.
2183
2429
  */
2184
- export function readdirSync(
2430
+ function readdirSync(
2185
2431
  path: PathLike,
2186
2432
  options: ObjectEncodingOptions & {
2187
2433
  withFileTypes: true;
@@ -2193,14 +2439,14 @@ declare module "_not-use-node-type_fs" {
2193
2439
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2194
2440
  * @param options Must include `withFileTypes: true` and `encoding: 'buffer'`.
2195
2441
  */
2196
- export function readdirSync(
2442
+ function readdirSync(
2197
2443
  path: PathLike,
2198
2444
  options: {
2199
2445
  encoding: "buffer";
2200
2446
  withFileTypes: true;
2201
2447
  recursive?: boolean | undefined;
2202
2448
  },
2203
- ): Dirent<Buffer>[];
2449
+ ): Dirent<NonSharedBuffer>[];
2204
2450
  /**
2205
2451
  * Closes the file descriptor. No arguments other than a possible exception are
2206
2452
  * given to the completion callback.
@@ -2211,8 +2457,8 @@ declare module "_not-use-node-type_fs" {
2211
2457
  * See the POSIX [`close(2)`](http://man7.org/linux/man-pages/man2/close.2.html) documentation for more detail.
2212
2458
  * @since v0.0.2
2213
2459
  */
2214
- export function close(fd: number, callback?: NoParamCallback): void;
2215
- export namespace close {
2460
+ function close(fd: number, callback?: NoParamCallback): void;
2461
+ namespace close {
2216
2462
  /**
2217
2463
  * Asynchronous close(2) - close a file descriptor.
2218
2464
  * @param fd A file descriptor.
@@ -2228,7 +2474,7 @@ declare module "_not-use-node-type_fs" {
2228
2474
  * See the POSIX [`close(2)`](http://man7.org/linux/man-pages/man2/close.2.html) documentation for more detail.
2229
2475
  * @since v0.1.21
2230
2476
  */
2231
- export function closeSync(fd: number): void;
2477
+ function closeSync(fd: number): void;
2232
2478
  /**
2233
2479
  * Asynchronous file open. See the POSIX [`open(2)`](http://man7.org/linux/man-pages/man2/open.2.html) documentation for more details.
2234
2480
  *
@@ -2246,7 +2492,7 @@ declare module "_not-use-node-type_fs" {
2246
2492
  * @param [flags='r'] See `support of file system `flags``.
2247
2493
  * @param [mode=0o666]
2248
2494
  */
2249
- export function open(
2495
+ function open(
2250
2496
  path: PathLike,
2251
2497
  flags: OpenMode | undefined,
2252
2498
  mode: Mode | undefined | null,
@@ -2257,7 +2503,7 @@ declare module "_not-use-node-type_fs" {
2257
2503
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2258
2504
  * @param [flags='r'] See `support of file system `flags``.
2259
2505
  */
2260
- export function open(
2506
+ function open(
2261
2507
  path: PathLike,
2262
2508
  flags: OpenMode | undefined,
2263
2509
  callback: (err: NodeJS.ErrnoException | null, fd: number) => void,
@@ -2266,8 +2512,8 @@ declare module "_not-use-node-type_fs" {
2266
2512
  * Asynchronous open(2) - open and possibly create a file. If the file is created, its mode will be `0o666`.
2267
2513
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2268
2514
  */
2269
- export function open(path: PathLike, callback: (err: NodeJS.ErrnoException | null, fd: number) => void): void;
2270
- export namespace open {
2515
+ function open(path: PathLike, callback: (err: NodeJS.ErrnoException | null, fd: number) => void): void;
2516
+ namespace open {
2271
2517
  /**
2272
2518
  * Asynchronous open(2) - open and possibly create a file.
2273
2519
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -2284,7 +2530,7 @@ declare module "_not-use-node-type_fs" {
2284
2530
  * @param [flags='r']
2285
2531
  * @param [mode=0o666]
2286
2532
  */
2287
- export function openSync(path: PathLike, flags: OpenMode, mode?: Mode | null): number;
2533
+ function openSync(path: PathLike, flags: OpenMode, mode?: Mode | null): number;
2288
2534
  /**
2289
2535
  * Change the file system timestamps of the object referenced by `path`.
2290
2536
  *
@@ -2294,8 +2540,8 @@ declare module "_not-use-node-type_fs" {
2294
2540
  * * If the value can not be converted to a number, or is `NaN`, `Infinity`, or `-Infinity`, an `Error` will be thrown.
2295
2541
  * @since v0.4.2
2296
2542
  */
2297
- export function utimes(path: PathLike, atime: TimeLike, mtime: TimeLike, callback: NoParamCallback): void;
2298
- export namespace utimes {
2543
+ function utimes(path: PathLike, atime: TimeLike, mtime: TimeLike, callback: NoParamCallback): void;
2544
+ namespace utimes {
2299
2545
  /**
2300
2546
  * Asynchronously change file timestamps of the file referenced by the supplied path.
2301
2547
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -2311,14 +2557,14 @@ declare module "_not-use-node-type_fs" {
2311
2557
  * this API: {@link utimes}.
2312
2558
  * @since v0.4.2
2313
2559
  */
2314
- export function utimesSync(path: PathLike, atime: TimeLike, mtime: TimeLike): void;
2560
+ function utimesSync(path: PathLike, atime: TimeLike, mtime: TimeLike): void;
2315
2561
  /**
2316
2562
  * Change the file system timestamps of the object referenced by the supplied file
2317
2563
  * descriptor. See {@link utimes}.
2318
2564
  * @since v0.4.2
2319
2565
  */
2320
- export function futimes(fd: number, atime: TimeLike, mtime: TimeLike, callback: NoParamCallback): void;
2321
- export namespace futimes {
2566
+ function futimes(fd: number, atime: TimeLike, mtime: TimeLike, callback: NoParamCallback): void;
2567
+ namespace futimes {
2322
2568
  /**
2323
2569
  * Asynchronously change file timestamps of the file referenced by the supplied file descriptor.
2324
2570
  * @param fd A file descriptor.
@@ -2331,7 +2577,7 @@ declare module "_not-use-node-type_fs" {
2331
2577
  * Synchronous version of {@link futimes}. Returns `undefined`.
2332
2578
  * @since v0.4.2
2333
2579
  */
2334
- export function futimesSync(fd: number, atime: TimeLike, mtime: TimeLike): void;
2580
+ function futimesSync(fd: number, atime: TimeLike, mtime: TimeLike): void;
2335
2581
  /**
2336
2582
  * Request that all data for the open file descriptor is flushed to the storage
2337
2583
  * device. The specific implementation is operating system and device specific.
@@ -2339,8 +2585,8 @@ declare module "_not-use-node-type_fs" {
2339
2585
  * than a possible exception are given to the completion callback.
2340
2586
  * @since v0.1.96
2341
2587
  */
2342
- export function fsync(fd: number, callback: NoParamCallback): void;
2343
- export namespace fsync {
2588
+ function fsync(fd: number, callback: NoParamCallback): void;
2589
+ namespace fsync {
2344
2590
  /**
2345
2591
  * Asynchronous fsync(2) - synchronize a file's in-core state with the underlying storage device.
2346
2592
  * @param fd A file descriptor.
@@ -2353,8 +2599,8 @@ declare module "_not-use-node-type_fs" {
2353
2599
  * Refer to the POSIX [`fsync(2)`](http://man7.org/linux/man-pages/man2/fsync.2.html) documentation for more detail. Returns `undefined`.
2354
2600
  * @since v0.1.96
2355
2601
  */
2356
- export function fsyncSync(fd: number): void;
2357
- export interface WriteOptions {
2602
+ function fsyncSync(fd: number): void;
2603
+ interface WriteOptions {
2358
2604
  /**
2359
2605
  * @default 0
2360
2606
  */
@@ -2366,7 +2612,7 @@ declare module "_not-use-node-type_fs" {
2366
2612
  /**
2367
2613
  * @default null
2368
2614
  */
2369
- position?: number | undefined | null;
2615
+ position?: number | null | undefined;
2370
2616
  }
2371
2617
  /**
2372
2618
  * Write `buffer` to the file specified by `fd`.
@@ -2395,7 +2641,7 @@ declare module "_not-use-node-type_fs" {
2395
2641
  * @param [length=buffer.byteLength - offset]
2396
2642
  * @param [position='null']
2397
2643
  */
2398
- export function write<TBuffer extends NodeJS.ArrayBufferView>(
2644
+ function write<TBuffer extends NodeJS.ArrayBufferView>(
2399
2645
  fd: number,
2400
2646
  buffer: TBuffer,
2401
2647
  offset: number | undefined | null,
@@ -2409,7 +2655,7 @@ declare module "_not-use-node-type_fs" {
2409
2655
  * @param offset The part of the buffer to be written. If not supplied, defaults to `0`.
2410
2656
  * @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`.
2411
2657
  */
2412
- export function write<TBuffer extends NodeJS.ArrayBufferView>(
2658
+ function write<TBuffer extends NodeJS.ArrayBufferView>(
2413
2659
  fd: number,
2414
2660
  buffer: TBuffer,
2415
2661
  offset: number | undefined | null,
@@ -2421,7 +2667,7 @@ declare module "_not-use-node-type_fs" {
2421
2667
  * @param fd A file descriptor.
2422
2668
  * @param offset The part of the buffer to be written. If not supplied, defaults to `0`.
2423
2669
  */
2424
- export function write<TBuffer extends NodeJS.ArrayBufferView>(
2670
+ function write<TBuffer extends NodeJS.ArrayBufferView>(
2425
2671
  fd: number,
2426
2672
  buffer: TBuffer,
2427
2673
  offset: number | undefined | null,
@@ -2431,7 +2677,7 @@ declare module "_not-use-node-type_fs" {
2431
2677
  * Asynchronously writes `buffer` to the file referenced by the supplied file descriptor.
2432
2678
  * @param fd A file descriptor.
2433
2679
  */
2434
- export function write<TBuffer extends NodeJS.ArrayBufferView>(
2680
+ function write<TBuffer extends NodeJS.ArrayBufferView>(
2435
2681
  fd: number,
2436
2682
  buffer: TBuffer,
2437
2683
  callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void,
@@ -2444,7 +2690,7 @@ declare module "_not-use-node-type_fs" {
2444
2690
  * * `length` The number of bytes to write. If not supplied, defaults to `buffer.length - offset`.
2445
2691
  * * `position` The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
2446
2692
  */
2447
- export function write<TBuffer extends NodeJS.ArrayBufferView>(
2693
+ function write<TBuffer extends NodeJS.ArrayBufferView>(
2448
2694
  fd: number,
2449
2695
  buffer: TBuffer,
2450
2696
  options: WriteOptions,
@@ -2457,7 +2703,7 @@ declare module "_not-use-node-type_fs" {
2457
2703
  * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
2458
2704
  * @param encoding The expected string encoding.
2459
2705
  */
2460
- export function write(
2706
+ function write(
2461
2707
  fd: number,
2462
2708
  string: string,
2463
2709
  position: number | undefined | null,
@@ -2470,7 +2716,7 @@ declare module "_not-use-node-type_fs" {
2470
2716
  * @param string A string to write.
2471
2717
  * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
2472
2718
  */
2473
- export function write(
2719
+ function write(
2474
2720
  fd: number,
2475
2721
  string: string,
2476
2722
  position: number | undefined | null,
@@ -2481,12 +2727,12 @@ declare module "_not-use-node-type_fs" {
2481
2727
  * @param fd A file descriptor.
2482
2728
  * @param string A string to write.
2483
2729
  */
2484
- export function write(
2730
+ function write(
2485
2731
  fd: number,
2486
2732
  string: string,
2487
2733
  callback: (err: NodeJS.ErrnoException | null, written: number, str: string) => void,
2488
2734
  ): void;
2489
- export namespace write {
2735
+ namespace write {
2490
2736
  /**
2491
2737
  * Asynchronously writes `buffer` to the file referenced by the supplied file descriptor.
2492
2738
  * @param fd A file descriptor.
@@ -2546,7 +2792,7 @@ declare module "_not-use-node-type_fs" {
2546
2792
  * @param [position='null']
2547
2793
  * @return The number of bytes written.
2548
2794
  */
2549
- export function writeSync(
2795
+ function writeSync(
2550
2796
  fd: number,
2551
2797
  buffer: NodeJS.ArrayBufferView,
2552
2798
  offset?: number | null,
@@ -2560,14 +2806,14 @@ declare module "_not-use-node-type_fs" {
2560
2806
  * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
2561
2807
  * @param encoding The expected string encoding.
2562
2808
  */
2563
- export function writeSync(
2809
+ function writeSync(
2564
2810
  fd: number,
2565
2811
  string: string,
2566
2812
  position?: number | null,
2567
2813
  encoding?: BufferEncoding | null,
2568
2814
  ): number;
2569
- export type ReadPosition = number | bigint;
2570
- export interface ReadSyncOptions {
2815
+ type ReadPosition = number | bigint;
2816
+ interface ReadOptions {
2571
2817
  /**
2572
2818
  * @default 0
2573
2819
  */
@@ -2581,9 +2827,15 @@ declare module "_not-use-node-type_fs" {
2581
2827
  */
2582
2828
  position?: ReadPosition | null | undefined;
2583
2829
  }
2584
- export interface ReadAsyncOptions<TBuffer extends NodeJS.ArrayBufferView> extends ReadSyncOptions {
2585
- buffer?: TBuffer;
2830
+ interface ReadOptionsWithBuffer<T extends NodeJS.ArrayBufferView> extends ReadOptions {
2831
+ buffer?: T | undefined;
2586
2832
  }
2833
+ /** @deprecated Use `ReadOptions` instead. */
2834
+ // TODO: remove in future major
2835
+ interface ReadSyncOptions extends ReadOptions {}
2836
+ /** @deprecated Use `ReadOptionsWithBuffer` instead. */
2837
+ // TODO: remove in future major
2838
+ interface ReadAsyncOptions<T extends NodeJS.ArrayBufferView> extends ReadOptionsWithBuffer<T> {}
2587
2839
  /**
2588
2840
  * Read data from the file specified by `fd`.
2589
2841
  *
@@ -2601,7 +2853,7 @@ declare module "_not-use-node-type_fs" {
2601
2853
  * @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
2602
2854
  * `position` is an integer, the file position will be unchanged.
2603
2855
  */
2604
- export function read<TBuffer extends NodeJS.ArrayBufferView>(
2856
+ function read<TBuffer extends NodeJS.ArrayBufferView>(
2605
2857
  fd: number,
2606
2858
  buffer: TBuffer,
2607
2859
  offset: number,
@@ -2618,27 +2870,27 @@ declare module "_not-use-node-type_fs" {
2618
2870
  * `position` defaults to `null`
2619
2871
  * @since v12.17.0, 13.11.0
2620
2872
  */
2621
- export function read<TBuffer extends NodeJS.ArrayBufferView>(
2873
+ function read<TBuffer extends NodeJS.ArrayBufferView = NonSharedBuffer>(
2622
2874
  fd: number,
2623
- options: ReadAsyncOptions<TBuffer>,
2875
+ options: ReadOptionsWithBuffer<TBuffer>,
2624
2876
  callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: TBuffer) => void,
2625
2877
  ): void;
2626
- export function read<TBuffer extends NodeJS.ArrayBufferView>(
2878
+ function read<TBuffer extends NodeJS.ArrayBufferView>(
2627
2879
  fd: number,
2628
2880
  buffer: TBuffer,
2629
- options: ReadSyncOptions,
2881
+ options: ReadOptions,
2630
2882
  callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: TBuffer) => void,
2631
2883
  ): void;
2632
- export function read<TBuffer extends NodeJS.ArrayBufferView>(
2884
+ function read<TBuffer extends NodeJS.ArrayBufferView>(
2633
2885
  fd: number,
2634
2886
  buffer: TBuffer,
2635
2887
  callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: TBuffer) => void,
2636
2888
  ): void;
2637
- export function read(
2889
+ function read(
2638
2890
  fd: number,
2639
- callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: NodeJS.ArrayBufferView) => void,
2891
+ callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: NonSharedBuffer) => void,
2640
2892
  ): void;
2641
- export namespace read {
2893
+ namespace read {
2642
2894
  /**
2643
2895
  * @param fd A file descriptor.
2644
2896
  * @param buffer The buffer that the data will be written to.
@@ -2656,16 +2908,16 @@ declare module "_not-use-node-type_fs" {
2656
2908
  bytesRead: number;
2657
2909
  buffer: TBuffer;
2658
2910
  }>;
2659
- function __promisify__<TBuffer extends NodeJS.ArrayBufferView>(
2911
+ function __promisify__<TBuffer extends NodeJS.ArrayBufferView = NonSharedBuffer>(
2660
2912
  fd: number,
2661
- options: ReadAsyncOptions<TBuffer>,
2913
+ options: ReadOptionsWithBuffer<TBuffer>,
2662
2914
  ): Promise<{
2663
2915
  bytesRead: number;
2664
2916
  buffer: TBuffer;
2665
2917
  }>;
2666
2918
  function __promisify__(fd: number): Promise<{
2667
2919
  bytesRead: number;
2668
- buffer: NodeJS.ArrayBufferView;
2920
+ buffer: NonSharedBuffer;
2669
2921
  }>;
2670
2922
  }
2671
2923
  /**
@@ -2676,7 +2928,7 @@ declare module "_not-use-node-type_fs" {
2676
2928
  * @since v0.1.21
2677
2929
  * @param [position='null']
2678
2930
  */
2679
- export function readSync(
2931
+ function readSync(
2680
2932
  fd: number,
2681
2933
  buffer: NodeJS.ArrayBufferView,
2682
2934
  offset: number,
@@ -2687,7 +2939,7 @@ declare module "_not-use-node-type_fs" {
2687
2939
  * Similar to the above `fs.readSync` function, this version takes an optional `options` object.
2688
2940
  * If no `options` object is specified, it will default with the above values.
2689
2941
  */
2690
- export function readSync(fd: number, buffer: NodeJS.ArrayBufferView, opts?: ReadSyncOptions): number;
2942
+ function readSync(fd: number, buffer: NodeJS.ArrayBufferView, opts?: ReadOptions): number;
2691
2943
  /**
2692
2944
  * Asynchronously reads the entire contents of a file.
2693
2945
  *
@@ -2754,7 +3006,7 @@ declare module "_not-use-node-type_fs" {
2754
3006
  * @since v0.1.29
2755
3007
  * @param path filename or file descriptor
2756
3008
  */
2757
- export function readFile(
3009
+ function readFile(
2758
3010
  path: PathOrFileDescriptor,
2759
3011
  options:
2760
3012
  | ({
@@ -2772,7 +3024,7 @@ declare module "_not-use-node-type_fs" {
2772
3024
  * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
2773
3025
  * If a flag is not provided, it defaults to `'r'`.
2774
3026
  */
2775
- export function readFile(
3027
+ function readFile(
2776
3028
  path: PathOrFileDescriptor,
2777
3029
  options:
2778
3030
  | ({
@@ -2789,7 +3041,7 @@ declare module "_not-use-node-type_fs" {
2789
3041
  * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
2790
3042
  * If a flag is not provided, it defaults to `'r'`.
2791
3043
  */
2792
- export function readFile(
3044
+ function readFile(
2793
3045
  path: PathOrFileDescriptor,
2794
3046
  options:
2795
3047
  | (ObjectEncodingOptions & {
@@ -2805,11 +3057,11 @@ declare module "_not-use-node-type_fs" {
2805
3057
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2806
3058
  * If a file descriptor is provided, the underlying file will _not_ be closed automatically.
2807
3059
  */
2808
- export function readFile(
3060
+ function readFile(
2809
3061
  path: PathOrFileDescriptor,
2810
3062
  callback: (err: NodeJS.ErrnoException | null, data: NonSharedBuffer) => void,
2811
3063
  ): void;
2812
- export namespace readFile {
3064
+ namespace readFile {
2813
3065
  /**
2814
3066
  * Asynchronously reads the entire contents of a file.
2815
3067
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -2883,7 +3135,7 @@ declare module "_not-use-node-type_fs" {
2883
3135
  * @since v0.1.8
2884
3136
  * @param path filename or file descriptor
2885
3137
  */
2886
- export function readFileSync(
3138
+ function readFileSync(
2887
3139
  path: PathOrFileDescriptor,
2888
3140
  options?: {
2889
3141
  encoding?: null | undefined;
@@ -2897,7 +3149,7 @@ declare module "_not-use-node-type_fs" {
2897
3149
  * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
2898
3150
  * If a flag is not provided, it defaults to `'r'`.
2899
3151
  */
2900
- export function readFileSync(
3152
+ function readFileSync(
2901
3153
  path: PathOrFileDescriptor,
2902
3154
  options:
2903
3155
  | {
@@ -2913,7 +3165,7 @@ declare module "_not-use-node-type_fs" {
2913
3165
  * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
2914
3166
  * If a flag is not provided, it defaults to `'r'`.
2915
3167
  */
2916
- export function readFileSync(
3168
+ function readFileSync(
2917
3169
  path: PathOrFileDescriptor,
2918
3170
  options?:
2919
3171
  | (ObjectEncodingOptions & {
@@ -2922,7 +3174,7 @@ declare module "_not-use-node-type_fs" {
2922
3174
  | BufferEncoding
2923
3175
  | null,
2924
3176
  ): string | NonSharedBuffer;
2925
- export type WriteFileOptions =
3177
+ type WriteFileOptions =
2926
3178
  | (
2927
3179
  & ObjectEncodingOptions
2928
3180
  & Abortable
@@ -2995,7 +3247,7 @@ declare module "_not-use-node-type_fs" {
2995
3247
  * @since v0.1.29
2996
3248
  * @param file filename or file descriptor
2997
3249
  */
2998
- export function writeFile(
3250
+ function writeFile(
2999
3251
  file: PathOrFileDescriptor,
3000
3252
  data: string | NodeJS.ArrayBufferView,
3001
3253
  options: WriteFileOptions,
@@ -3007,12 +3259,12 @@ declare module "_not-use-node-type_fs" {
3007
3259
  * If a file descriptor is provided, the underlying file will _not_ be closed automatically.
3008
3260
  * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string.
3009
3261
  */
3010
- export function writeFile(
3262
+ function writeFile(
3011
3263
  path: PathOrFileDescriptor,
3012
3264
  data: string | NodeJS.ArrayBufferView,
3013
3265
  callback: NoParamCallback,
3014
3266
  ): void;
3015
- export namespace writeFile {
3267
+ namespace writeFile {
3016
3268
  /**
3017
3269
  * Asynchronously writes data to a file, replacing the file if it already exists.
3018
3270
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -3041,7 +3293,7 @@ declare module "_not-use-node-type_fs" {
3041
3293
  * @since v0.1.29
3042
3294
  * @param file filename or file descriptor
3043
3295
  */
3044
- export function writeFileSync(
3296
+ function writeFileSync(
3045
3297
  file: PathOrFileDescriptor,
3046
3298
  data: string | NodeJS.ArrayBufferView,
3047
3299
  options?: WriteFileOptions,
@@ -3099,7 +3351,7 @@ declare module "_not-use-node-type_fs" {
3099
3351
  * @since v0.6.7
3100
3352
  * @param path filename or file descriptor
3101
3353
  */
3102
- export function appendFile(
3354
+ function appendFile(
3103
3355
  path: PathOrFileDescriptor,
3104
3356
  data: string | Uint8Array,
3105
3357
  options: WriteFileOptions,
@@ -3111,8 +3363,8 @@ declare module "_not-use-node-type_fs" {
3111
3363
  * If a file descriptor is provided, the underlying file will _not_ be closed automatically.
3112
3364
  * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string.
3113
3365
  */
3114
- export function appendFile(file: PathOrFileDescriptor, data: string | Uint8Array, callback: NoParamCallback): void;
3115
- export namespace appendFile {
3366
+ function appendFile(file: PathOrFileDescriptor, data: string | Uint8Array, callback: NoParamCallback): void;
3367
+ namespace appendFile {
3116
3368
  /**
3117
3369
  * Asynchronously append data to a file, creating the file if it does not exist.
3118
3370
  * @param file A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -3178,7 +3430,7 @@ declare module "_not-use-node-type_fs" {
3178
3430
  * @since v0.6.7
3179
3431
  * @param path filename or file descriptor
3180
3432
  */
3181
- export function appendFileSync(
3433
+ function appendFileSync(
3182
3434
  path: PathOrFileDescriptor,
3183
3435
  data: string | Uint8Array,
3184
3436
  options?: WriteFileOptions,
@@ -3229,7 +3481,7 @@ declare module "_not-use-node-type_fs" {
3229
3481
  * * the file is renamed and then renamed a second time back to its original name
3230
3482
  * @since v0.1.31
3231
3483
  */
3232
- export interface WatchFileOptions {
3484
+ interface WatchFileOptions {
3233
3485
  bigint?: boolean | undefined;
3234
3486
  persistent?: boolean | undefined;
3235
3487
  interval?: number | undefined;
@@ -3280,7 +3532,7 @@ declare module "_not-use-node-type_fs" {
3280
3532
  * * the file is renamed and then renamed a second time back to its original name
3281
3533
  * @since v0.1.31
3282
3534
  */
3283
- export function watchFile(
3535
+ function watchFile(
3284
3536
  filename: PathLike,
3285
3537
  options:
3286
3538
  | (WatchFileOptions & {
@@ -3289,7 +3541,7 @@ declare module "_not-use-node-type_fs" {
3289
3541
  | undefined,
3290
3542
  listener: StatsListener,
3291
3543
  ): StatWatcher;
3292
- export function watchFile(
3544
+ function watchFile(
3293
3545
  filename: PathLike,
3294
3546
  options:
3295
3547
  | (WatchFileOptions & {
@@ -3302,7 +3554,7 @@ declare module "_not-use-node-type_fs" {
3302
3554
  * Watch for changes on `filename`. The callback `listener` will be called each time the file is accessed.
3303
3555
  * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
3304
3556
  */
3305
- export function watchFile(filename: PathLike, listener: StatsListener): StatWatcher;
3557
+ function watchFile(filename: PathLike, listener: StatsListener): StatWatcher;
3306
3558
  /**
3307
3559
  * Stop watching for changes on `filename`. If `listener` is specified, only that
3308
3560
  * particular listener is removed. Otherwise, _all_ listeners are removed,
@@ -3315,17 +3567,23 @@ declare module "_not-use-node-type_fs" {
3315
3567
  * @since v0.1.31
3316
3568
  * @param listener Optional, a listener previously attached using `fs.watchFile()`
3317
3569
  */
3318
- export function unwatchFile(filename: PathLike, listener?: StatsListener): void;
3319
- export function unwatchFile(filename: PathLike, listener?: BigIntStatsListener): void;
3320
- export interface WatchOptions extends Abortable {
3570
+ function unwatchFile(filename: PathLike, listener?: StatsListener): void;
3571
+ function unwatchFile(filename: PathLike, listener?: BigIntStatsListener): void;
3572
+ interface WatchOptions extends Abortable {
3321
3573
  encoding?: BufferEncoding | "buffer" | undefined;
3322
3574
  persistent?: boolean | undefined;
3323
3575
  recursive?: boolean | undefined;
3324
3576
  }
3325
- export type WatchEventType = "rename" | "change";
3326
- export type WatchListener<T> = (event: WatchEventType, filename: T | null) => void;
3327
- export type StatsListener = (curr: Stats, prev: Stats) => void;
3328
- export type BigIntStatsListener = (curr: BigIntStats, prev: BigIntStats) => void;
3577
+ interface WatchOptionsWithBufferEncoding extends WatchOptions {
3578
+ encoding: "buffer";
3579
+ }
3580
+ interface WatchOptionsWithStringEncoding extends WatchOptions {
3581
+ encoding?: BufferEncoding | undefined;
3582
+ }
3583
+ type WatchEventType = "rename" | "change";
3584
+ type WatchListener<T> = (event: WatchEventType, filename: T | null) => void;
3585
+ type StatsListener = (curr: Stats, prev: Stats) => void;
3586
+ type BigIntStatsListener = (curr: BigIntStats, prev: BigIntStats) => void;
3329
3587
  /**
3330
3588
  * Watch for changes on `filename`, where `filename` is either a file or a
3331
3589
  * directory.
@@ -3346,46 +3604,22 @@ declare module "_not-use-node-type_fs" {
3346
3604
  * @since v0.5.10
3347
3605
  * @param listener
3348
3606
  */
3349
- export function watch(
3607
+ function watch(
3350
3608
  filename: PathLike,
3351
- options:
3352
- | (WatchOptions & {
3353
- encoding: "buffer";
3354
- })
3355
- | "buffer",
3356
- listener?: WatchListener<Buffer>,
3609
+ options?: WatchOptionsWithStringEncoding | BufferEncoding | null,
3610
+ listener?: WatchListener<string>,
3357
3611
  ): FSWatcher;
3358
- /**
3359
- * Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`.
3360
- * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
3361
- * @param options Either the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options.
3362
- * If `encoding` is not supplied, the default of `'utf8'` is used.
3363
- * If `persistent` is not supplied, the default of `true` is used.
3364
- * If `recursive` is not supplied, the default of `false` is used.
3365
- */
3366
- export function watch(
3612
+ function watch(
3367
3613
  filename: PathLike,
3368
- options?: WatchOptions | BufferEncoding | null,
3369
- listener?: WatchListener<string>,
3614
+ options: WatchOptionsWithBufferEncoding | "buffer",
3615
+ listener: WatchListener<NonSharedBuffer>,
3370
3616
  ): FSWatcher;
3371
- /**
3372
- * Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`.
3373
- * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
3374
- * @param options Either the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options.
3375
- * If `encoding` is not supplied, the default of `'utf8'` is used.
3376
- * If `persistent` is not supplied, the default of `true` is used.
3377
- * If `recursive` is not supplied, the default of `false` is used.
3378
- */
3379
- export function watch(
3617
+ function watch(
3380
3618
  filename: PathLike,
3381
- options: WatchOptions | string,
3382
- listener?: WatchListener<string | Buffer>,
3619
+ options: WatchOptions | BufferEncoding | "buffer" | null,
3620
+ listener: WatchListener<string | NonSharedBuffer>,
3383
3621
  ): FSWatcher;
3384
- /**
3385
- * Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`.
3386
- * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
3387
- */
3388
- export function watch(filename: PathLike, listener?: WatchListener<string>): FSWatcher;
3622
+ function watch(filename: PathLike, listener: WatchListener<string>): FSWatcher;
3389
3623
  /**
3390
3624
  * Test whether or not the given path exists by checking with the file system.
3391
3625
  * Then call the `callback` argument with either true or false:
@@ -3515,9 +3749,9 @@ declare module "_not-use-node-type_fs" {
3515
3749
  * @since v0.0.2
3516
3750
  * @deprecated Since v1.0.0 - Use {@link stat} or {@link access} instead.
3517
3751
  */
3518
- export function exists(path: PathLike, callback: (exists: boolean) => void): void;
3752
+ function exists(path: PathLike, callback: (exists: boolean) => void): void;
3519
3753
  /** @deprecated */
3520
- export namespace exists {
3754
+ namespace exists {
3521
3755
  /**
3522
3756
  * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
3523
3757
  * URL support is _experimental_.
@@ -3541,8 +3775,8 @@ declare module "_not-use-node-type_fs" {
3541
3775
  * ```
3542
3776
  * @since v0.1.21
3543
3777
  */
3544
- export function existsSync(path: PathLike): boolean;
3545
- export namespace constants {
3778
+ function existsSync(path: PathLike): boolean;
3779
+ namespace constants {
3546
3780
  // File Access Constants
3547
3781
  /** Constant for fs.access(). File is visible to the calling process. */
3548
3782
  const F_OK: number;
@@ -3816,13 +4050,13 @@ declare module "_not-use-node-type_fs" {
3816
4050
  * @since v0.11.15
3817
4051
  * @param [mode=fs.constants.F_OK]
3818
4052
  */
3819
- export function access(path: PathLike, mode: number | undefined, callback: NoParamCallback): void;
4053
+ function access(path: PathLike, mode: number | undefined, callback: NoParamCallback): void;
3820
4054
  /**
3821
4055
  * Asynchronously tests a user's permissions for the file specified by path.
3822
4056
  * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
3823
4057
  */
3824
- export function access(path: PathLike, callback: NoParamCallback): void;
3825
- export namespace access {
4058
+ function access(path: PathLike, callback: NoParamCallback): void;
4059
+ namespace access {
3826
4060
  /**
3827
4061
  * Asynchronously tests a user's permissions for the file specified by path.
3828
4062
  * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
@@ -3853,11 +4087,11 @@ declare module "_not-use-node-type_fs" {
3853
4087
  * @since v0.11.15
3854
4088
  * @param [mode=fs.constants.F_OK]
3855
4089
  */
3856
- export function accessSync(path: PathLike, mode?: number): void;
4090
+ function accessSync(path: PathLike, mode?: number): void;
3857
4091
  interface StreamOptions {
3858
4092
  flags?: string | undefined;
3859
4093
  encoding?: BufferEncoding | undefined;
3860
- fd?: number | promises.FileHandle | undefined;
4094
+ fd?: number | FileHandle | undefined;
3861
4095
  mode?: number | undefined;
3862
4096
  autoClose?: boolean | undefined;
3863
4097
  emitClose?: boolean | undefined;
@@ -3945,7 +4179,7 @@ declare module "_not-use-node-type_fs" {
3945
4179
  * If `options` is a string, then it specifies the encoding.
3946
4180
  * @since v0.1.31
3947
4181
  */
3948
- export function createReadStream(path: PathLike, options?: BufferEncoding | ReadStreamOptions): ReadStream;
4182
+ function createReadStream(path: PathLike, options?: BufferEncoding | ReadStreamOptions): ReadStream;
3949
4183
  /**
3950
4184
  * `options` may also include a `start` option to allow writing data at some
3951
4185
  * position past the beginning of the file, allowed values are in the
@@ -3973,7 +4207,7 @@ declare module "_not-use-node-type_fs" {
3973
4207
  * If `options` is a string, then it specifies the encoding.
3974
4208
  * @since v0.1.31
3975
4209
  */
3976
- export function createWriteStream(path: PathLike, options?: BufferEncoding | WriteStreamOptions): WriteStream;
4210
+ function createWriteStream(path: PathLike, options?: BufferEncoding | WriteStreamOptions): WriteStream;
3977
4211
  /**
3978
4212
  * Forces all currently queued I/O operations associated with the file to the
3979
4213
  * 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
@@ -3981,8 +4215,8 @@ declare module "_not-use-node-type_fs" {
3981
4215
  * exception are given to the completion callback.
3982
4216
  * @since v0.1.96
3983
4217
  */
3984
- export function fdatasync(fd: number, callback: NoParamCallback): void;
3985
- export namespace fdatasync {
4218
+ function fdatasync(fd: number, callback: NoParamCallback): void;
4219
+ namespace fdatasync {
3986
4220
  /**
3987
4221
  * Asynchronous fdatasync(2) - synchronize a file's in-core state with storage device.
3988
4222
  * @param fd A file descriptor.
@@ -3994,7 +4228,7 @@ declare module "_not-use-node-type_fs" {
3994
4228
  * 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`.
3995
4229
  * @since v0.1.96
3996
4230
  */
3997
- export function fdatasyncSync(fd: number): void;
4231
+ function fdatasyncSync(fd: number): void;
3998
4232
  /**
3999
4233
  * Asynchronously copies `src` to `dest`. By default, `dest` is overwritten if it
4000
4234
  * already exists. No arguments other than a possible exception are given to the
@@ -4034,9 +4268,9 @@ declare module "_not-use-node-type_fs" {
4034
4268
  * @param dest destination filename of the copy operation
4035
4269
  * @param [mode=0] modifiers for copy operation.
4036
4270
  */
4037
- export function copyFile(src: PathLike, dest: PathLike, callback: NoParamCallback): void;
4038
- export function copyFile(src: PathLike, dest: PathLike, mode: number, callback: NoParamCallback): void;
4039
- export namespace copyFile {
4271
+ function copyFile(src: PathLike, dest: PathLike, callback: NoParamCallback): void;
4272
+ function copyFile(src: PathLike, dest: PathLike, mode: number, callback: NoParamCallback): void;
4273
+ namespace copyFile {
4040
4274
  function __promisify__(src: PathLike, dst: PathLike, mode?: number): Promise<void>;
4041
4275
  }
4042
4276
  /**
@@ -4073,7 +4307,7 @@ declare module "_not-use-node-type_fs" {
4073
4307
  * @param dest destination filename of the copy operation
4074
4308
  * @param [mode=0] modifiers for copy operation.
4075
4309
  */
4076
- export function copyFileSync(src: PathLike, dest: PathLike, mode?: number): void;
4310
+ function copyFileSync(src: PathLike, dest: PathLike, mode?: number): void;
4077
4311
  /**
4078
4312
  * Write an array of `ArrayBufferView`s to the file specified by `fd` using `writev()`.
4079
4313
  *
@@ -4094,27 +4328,29 @@ declare module "_not-use-node-type_fs" {
4094
4328
  * @since v12.9.0
4095
4329
  * @param [position='null']
4096
4330
  */
4097
- export function writev(
4331
+ function writev<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
4098
4332
  fd: number,
4099
- buffers: readonly NodeJS.ArrayBufferView[],
4100
- cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers: NodeJS.ArrayBufferView[]) => void,
4333
+ buffers: TBuffers,
4334
+ cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers: TBuffers) => void,
4101
4335
  ): void;
4102
- export function writev(
4336
+ function writev<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
4103
4337
  fd: number,
4104
- buffers: readonly NodeJS.ArrayBufferView[],
4338
+ buffers: TBuffers,
4105
4339
  position: number | null,
4106
- cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers: NodeJS.ArrayBufferView[]) => void,
4340
+ cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers: TBuffers) => void,
4107
4341
  ): void;
4108
- export interface WriteVResult {
4342
+ // Providing a default type parameter doesn't provide true BC for userland consumers, but at least suppresses TS2314
4343
+ // TODO: remove default in future major version
4344
+ interface WriteVResult<T extends readonly NodeJS.ArrayBufferView[] = NodeJS.ArrayBufferView[]> {
4109
4345
  bytesWritten: number;
4110
- buffers: NodeJS.ArrayBufferView[];
4346
+ buffers: T;
4111
4347
  }
4112
- export namespace writev {
4113
- function __promisify__(
4348
+ namespace writev {
4349
+ function __promisify__<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
4114
4350
  fd: number,
4115
- buffers: readonly NodeJS.ArrayBufferView[],
4351
+ buffers: TBuffers,
4116
4352
  position?: number,
4117
- ): Promise<WriteVResult>;
4353
+ ): Promise<WriteVResult<TBuffers>>;
4118
4354
  }
4119
4355
  /**
4120
4356
  * For detailed information, see the documentation of the asynchronous version of
@@ -4123,7 +4359,7 @@ declare module "_not-use-node-type_fs" {
4123
4359
  * @param [position='null']
4124
4360
  * @return The number of bytes written.
4125
4361
  */
4126
- export function writevSync(fd: number, buffers: readonly NodeJS.ArrayBufferView[], position?: number): number;
4362
+ function writevSync(fd: number, buffers: readonly NodeJS.ArrayBufferView[], position?: number): number;
4127
4363
  /**
4128
4364
  * Read from a file specified by `fd` and write to an array of `ArrayBufferView`s
4129
4365
  * using `readv()`.
@@ -4139,27 +4375,29 @@ declare module "_not-use-node-type_fs" {
4139
4375
  * @since v13.13.0, v12.17.0
4140
4376
  * @param [position='null']
4141
4377
  */
4142
- export function readv(
4378
+ function readv<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
4143
4379
  fd: number,
4144
- buffers: readonly NodeJS.ArrayBufferView[],
4145
- cb: (err: NodeJS.ErrnoException | null, bytesRead: number, buffers: NodeJS.ArrayBufferView[]) => void,
4380
+ buffers: TBuffers,
4381
+ cb: (err: NodeJS.ErrnoException | null, bytesRead: number, buffers: TBuffers) => void,
4146
4382
  ): void;
4147
- export function readv(
4383
+ function readv<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
4148
4384
  fd: number,
4149
- buffers: readonly NodeJS.ArrayBufferView[],
4385
+ buffers: TBuffers,
4150
4386
  position: number | null,
4151
- cb: (err: NodeJS.ErrnoException | null, bytesRead: number, buffers: NodeJS.ArrayBufferView[]) => void,
4387
+ cb: (err: NodeJS.ErrnoException | null, bytesRead: number, buffers: TBuffers) => void,
4152
4388
  ): void;
4153
- export interface ReadVResult {
4389
+ // Providing a default type parameter doesn't provide true BC for userland consumers, but at least suppresses TS2314
4390
+ // TODO: remove default in future major version
4391
+ interface ReadVResult<T extends readonly NodeJS.ArrayBufferView[] = NodeJS.ArrayBufferView[]> {
4154
4392
  bytesRead: number;
4155
- buffers: NodeJS.ArrayBufferView[];
4393
+ buffers: T;
4156
4394
  }
4157
- export namespace readv {
4158
- function __promisify__(
4395
+ namespace readv {
4396
+ function __promisify__<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
4159
4397
  fd: number,
4160
- buffers: readonly NodeJS.ArrayBufferView[],
4398
+ buffers: TBuffers,
4161
4399
  position?: number,
4162
- ): Promise<ReadVResult>;
4400
+ ): Promise<ReadVResult<TBuffers>>;
4163
4401
  }
4164
4402
  /**
4165
4403
  * For detailed information, see the documentation of the asynchronous version of
@@ -4168,9 +4406,9 @@ declare module "_not-use-node-type_fs" {
4168
4406
  * @param [position='null']
4169
4407
  * @return The number of bytes read.
4170
4408
  */
4171
- export function readvSync(fd: number, buffers: readonly NodeJS.ArrayBufferView[], position?: number): number;
4409
+ function readvSync(fd: number, buffers: readonly NodeJS.ArrayBufferView[], position?: number): number;
4172
4410
 
4173
- export interface OpenAsBlobOptions {
4411
+ interface OpenAsBlobOptions {
4174
4412
  /**
4175
4413
  * An optional mime type for the blob.
4176
4414
  *
@@ -4196,9 +4434,9 @@ declare module "_not-use-node-type_fs" {
4196
4434
  * ```
4197
4435
  * @since v19.8.0
4198
4436
  */
4199
- export function openAsBlob(path: PathLike, options?: OpenAsBlobOptions): Promise<Blob>;
4437
+ function openAsBlob(path: PathLike, options?: OpenAsBlobOptions): Promise<Blob>;
4200
4438
 
4201
- export interface OpenDirOptions {
4439
+ interface OpenDirOptions {
4202
4440
  /**
4203
4441
  * @default 'utf8'
4204
4442
  */
@@ -4213,7 +4451,7 @@ declare module "_not-use-node-type_fs" {
4213
4451
  /**
4214
4452
  * @default false
4215
4453
  */
4216
- recursive?: boolean;
4454
+ recursive?: boolean | undefined;
4217
4455
  }
4218
4456
  /**
4219
4457
  * Synchronously open a directory. See [`opendir(3)`](http://man7.org/linux/man-pages/man3/opendir.3.html).
@@ -4225,7 +4463,7 @@ declare module "_not-use-node-type_fs" {
4225
4463
  * directory and subsequent read operations.
4226
4464
  * @since v12.12.0
4227
4465
  */
4228
- export function opendirSync(path: PathLike, options?: OpenDirOptions): Dir;
4466
+ function opendirSync(path: PathLike, options?: OpenDirOptions): Dir;
4229
4467
  /**
4230
4468
  * Asynchronously open a directory. See the POSIX [`opendir(3)`](http://man7.org/linux/man-pages/man3/opendir.3.html) documentation for
4231
4469
  * more details.
@@ -4237,28 +4475,28 @@ declare module "_not-use-node-type_fs" {
4237
4475
  * directory and subsequent read operations.
4238
4476
  * @since v12.12.0
4239
4477
  */
4240
- export function opendir(path: PathLike, cb: (err: NodeJS.ErrnoException | null, dir: Dir) => void): void;
4241
- export function opendir(
4478
+ function opendir(path: PathLike, cb: (err: NodeJS.ErrnoException | null, dir: Dir) => void): void;
4479
+ function opendir(
4242
4480
  path: PathLike,
4243
4481
  options: OpenDirOptions,
4244
4482
  cb: (err: NodeJS.ErrnoException | null, dir: Dir) => void,
4245
4483
  ): void;
4246
- export namespace opendir {
4484
+ namespace opendir {
4247
4485
  function __promisify__(path: PathLike, options?: OpenDirOptions): Promise<Dir>;
4248
4486
  }
4249
- export interface BigIntStats extends StatsBase<bigint> {
4487
+ interface BigIntStats extends StatsBase<bigint> {
4250
4488
  atimeNs: bigint;
4251
4489
  mtimeNs: bigint;
4252
4490
  ctimeNs: bigint;
4253
4491
  birthtimeNs: bigint;
4254
4492
  }
4255
- export interface BigIntOptions {
4493
+ interface BigIntOptions {
4256
4494
  bigint: true;
4257
4495
  }
4258
- export interface StatOptions {
4496
+ interface StatOptions {
4259
4497
  bigint?: boolean | undefined;
4260
4498
  }
4261
- export interface StatSyncOptions extends StatOptions {
4499
+ interface StatSyncOptions extends StatOptions {
4262
4500
  throwIfNoEntry?: boolean | undefined;
4263
4501
  }
4264
4502
  interface CopyOptionsBase {
@@ -4266,54 +4504,54 @@ declare module "_not-use-node-type_fs" {
4266
4504
  * Dereference symlinks
4267
4505
  * @default false
4268
4506
  */
4269
- dereference?: boolean;
4507
+ dereference?: boolean | undefined;
4270
4508
  /**
4271
4509
  * When `force` is `false`, and the destination
4272
4510
  * exists, throw an error.
4273
4511
  * @default false
4274
4512
  */
4275
- errorOnExist?: boolean;
4513
+ errorOnExist?: boolean | undefined;
4276
4514
  /**
4277
4515
  * Overwrite existing file or directory. _The copy
4278
4516
  * operation will ignore errors if you set this to false and the destination
4279
4517
  * exists. Use the `errorOnExist` option to change this behavior.
4280
4518
  * @default true
4281
4519
  */
4282
- force?: boolean;
4520
+ force?: boolean | undefined;
4283
4521
  /**
4284
4522
  * Modifiers for copy operation. See `mode` flag of {@link copyFileSync()}
4285
4523
  */
4286
- mode?: number;
4524
+ mode?: number | undefined;
4287
4525
  /**
4288
4526
  * When `true` timestamps from `src` will
4289
4527
  * be preserved.
4290
4528
  * @default false
4291
4529
  */
4292
- preserveTimestamps?: boolean;
4530
+ preserveTimestamps?: boolean | undefined;
4293
4531
  /**
4294
4532
  * Copy directories recursively.
4295
4533
  * @default false
4296
4534
  */
4297
- recursive?: boolean;
4535
+ recursive?: boolean | undefined;
4298
4536
  /**
4299
4537
  * When true, path resolution for symlinks will be skipped
4300
4538
  * @default false
4301
4539
  */
4302
- verbatimSymlinks?: boolean;
4540
+ verbatimSymlinks?: boolean | undefined;
4303
4541
  }
4304
- export interface CopyOptions extends CopyOptionsBase {
4542
+ interface CopyOptions extends CopyOptionsBase {
4305
4543
  /**
4306
4544
  * Function to filter copied files/directories. Return
4307
4545
  * `true` to copy the item, `false` to ignore it.
4308
4546
  */
4309
- filter?(source: string, destination: string): boolean | Promise<boolean>;
4547
+ filter?: ((source: string, destination: string) => boolean | Promise<boolean>) | undefined;
4310
4548
  }
4311
- export interface CopySyncOptions extends CopyOptionsBase {
4549
+ interface CopySyncOptions extends CopyOptionsBase {
4312
4550
  /**
4313
4551
  * Function to filter copied files/directories. Return
4314
4552
  * `true` to copy the item, `false` to ignore it.
4315
4553
  */
4316
- filter?(source: string, destination: string): boolean;
4554
+ filter?: ((source: string, destination: string) => boolean) | undefined;
4317
4555
  }
4318
4556
  /**
4319
4557
  * Asynchronously copies the entire directory structure from `src` to `dest`,
@@ -4326,12 +4564,12 @@ declare module "_not-use-node-type_fs" {
4326
4564
  * @param src source path to copy.
4327
4565
  * @param dest destination path to copy to.
4328
4566
  */
4329
- export function cp(
4567
+ function cp(
4330
4568
  source: string | URL,
4331
4569
  destination: string | URL,
4332
4570
  callback: (err: NodeJS.ErrnoException | null) => void,
4333
4571
  ): void;
4334
- export function cp(
4572
+ function cp(
4335
4573
  source: string | URL,
4336
4574
  destination: string | URL,
4337
4575
  opts: CopyOptions,
@@ -4348,14 +4586,15 @@ declare module "_not-use-node-type_fs" {
4348
4586
  * @param src source path to copy.
4349
4587
  * @param dest destination path to copy to.
4350
4588
  */
4351
- export function cpSync(source: string | URL, destination: string | URL, opts?: CopySyncOptions): void;
4589
+ function cpSync(source: string | URL, destination: string | URL, opts?: CopySyncOptions): void;
4352
4590
 
4591
+ // TODO: collapse
4353
4592
  interface _GlobOptions<T extends Dirent | string> {
4354
4593
  /**
4355
4594
  * Current working directory.
4356
4595
  * @default process.cwd()
4357
4596
  */
4358
- cwd?: string | undefined;
4597
+ cwd?: string | URL | undefined;
4359
4598
  /**
4360
4599
  * `true` if the glob should return paths as `Dirent`s, `false` otherwise.
4361
4600
  * @default false
@@ -4366,15 +4605,18 @@ declare module "_not-use-node-type_fs" {
4366
4605
  * Function to filter out files/directories or a
4367
4606
  * list of glob patterns to be excluded. If a function is provided, return
4368
4607
  * `true` to exclude the item, `false` to include it.
4608
+ * If a string array is provided, each string should be a glob pattern that
4609
+ * specifies paths to exclude. Note: Negation patterns (e.g., '!foo.js') are
4610
+ * not supported.
4369
4611
  * @default undefined
4370
4612
  */
4371
4613
  exclude?: ((fileName: T) => boolean) | readonly string[] | undefined;
4372
4614
  }
4373
- export interface GlobOptions extends _GlobOptions<Dirent | string> {}
4374
- export interface GlobOptionsWithFileTypes extends _GlobOptions<Dirent> {
4615
+ interface GlobOptions extends _GlobOptions<Dirent | string> {}
4616
+ interface GlobOptionsWithFileTypes extends _GlobOptions<Dirent> {
4375
4617
  withFileTypes: true;
4376
4618
  }
4377
- export interface GlobOptionsWithoutFileTypes extends _GlobOptions<string> {
4619
+ interface GlobOptionsWithoutFileTypes extends _GlobOptions<string> {
4378
4620
  withFileTypes?: false | undefined;
4379
4621
  }
4380
4622
 
@@ -4391,11 +4633,11 @@ declare module "_not-use-node-type_fs" {
4391
4633
  * ```
4392
4634
  * @since v22.0.0
4393
4635
  */
4394
- export function glob(
4636
+ function glob(
4395
4637
  pattern: string | readonly string[],
4396
4638
  callback: (err: NodeJS.ErrnoException | null, matches: string[]) => void,
4397
4639
  ): void;
4398
- export function glob(
4640
+ function glob(
4399
4641
  pattern: string | readonly string[],
4400
4642
  options: GlobOptionsWithFileTypes,
4401
4643
  callback: (
@@ -4403,7 +4645,7 @@ declare module "_not-use-node-type_fs" {
4403
4645
  matches: Dirent[],
4404
4646
  ) => void,
4405
4647
  ): void;
4406
- export function glob(
4648
+ function glob(
4407
4649
  pattern: string | readonly string[],
4408
4650
  options: GlobOptionsWithoutFileTypes,
4409
4651
  callback: (
@@ -4411,7 +4653,7 @@ declare module "_not-use-node-type_fs" {
4411
4653
  matches: string[],
4412
4654
  ) => void,
4413
4655
  ): void;
4414
- export function glob(
4656
+ function glob(
4415
4657
  pattern: string | readonly string[],
4416
4658
  options: GlobOptions,
4417
4659
  callback: (
@@ -4428,17 +4670,20 @@ declare module "_not-use-node-type_fs" {
4428
4670
  * @since v22.0.0
4429
4671
  * @returns paths of files that match the pattern.
4430
4672
  */
4431
- export function globSync(pattern: string | readonly string[]): string[];
4432
- export function globSync(
4673
+ function globSync(pattern: string | readonly string[]): string[];
4674
+ function globSync(
4433
4675
  pattern: string | readonly string[],
4434
4676
  options: GlobOptionsWithFileTypes,
4435
4677
  ): Dirent[];
4436
- export function globSync(
4678
+ function globSync(
4437
4679
  pattern: string | readonly string[],
4438
4680
  options: GlobOptionsWithoutFileTypes,
4439
4681
  ): string[];
4440
- export function globSync(
4682
+ function globSync(
4441
4683
  pattern: string | readonly string[],
4442
4684
  options: GlobOptions,
4443
4685
  ): Dirent[] | string[];
4444
4686
  }
4687
+ declare module "_not-use-node-type_fs" {
4688
+ export * as promises from "node:fs/promises";
4689
+ }