@types/node 16.11.39 → 18.11.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. {node v16.11 → node}/LICENSE +0 -0
  2. node v16.11/README.md → node/README.md +4 -4
  3. {node v16.11 → node}/assert/strict.d.ts +0 -0
  4. node v16.11/assert.d.ts → node/assert.d.ts +7 -8
  5. node v16.11/async_hooks.d.ts → node/async_hooks.d.ts +8 -4
  6. node/buffer.d.ts +2258 -0
  7. node v16.11/child_process.d.ts → node/child_process.d.ts +6 -3
  8. node v16.11/cluster.d.ts → node/cluster.d.ts +14 -18
  9. node v16.11/console.d.ts → node/console.d.ts +1 -1
  10. {node v16.11 → node}/constants.d.ts +0 -0
  11. node v16.11/crypto.d.ts → node/crypto.d.ts +679 -53
  12. node v16.11/dgram.d.ts → node/dgram.d.ts +3 -3
  13. node v16.11/diagnostics_channel.d.ts → node/diagnostics_channel.d.ts +2 -1
  14. node v16.11/dns/promises.d.ts → node/dns/promises.d.ts +10 -8
  15. node v16.11/dns.d.ts → node/dns.d.ts +16 -11
  16. node/dom-events.d.ts +126 -0
  17. node v16.11/domain.d.ts → node/domain.d.ts +3 -2
  18. node v16.11/events.d.ts → node/events.d.ts +65 -10
  19. node v16.11/fs/promises.d.ts → node/fs/promises.d.ts +86 -39
  20. node v16.11/fs.d.ts → node/fs.d.ts +149 -67
  21. node/globals.d.ts +300 -0
  22. {node v16.11 → node}/globals.global.d.ts +0 -0
  23. node v16.11/http.d.ts → node/http.d.ts +305 -77
  24. node v16.11/http2.d.ts → node/http2.d.ts +38 -5
  25. node v16.11/https.d.ts → node/https.d.ts +209 -59
  26. node v16.11/index.d.ts → node/index.d.ts +6 -3
  27. node v16.11/inspector.d.ts → node/inspector.d.ts +11 -15
  28. {node v16.11 → node}/module.d.ts +0 -0
  29. node v16.11/net.d.ts → node/net.d.ts +94 -21
  30. node v16.11/os.d.ts → node/os.d.ts +15 -4
  31. node v16.11/package.json → node/package.json +15 -8
  32. node v16.11/path.d.ts → node/path.d.ts +34 -23
  33. node v16.11/perf_hooks.d.ts → node/perf_hooks.d.ts +76 -8
  34. node v16.11/process.d.ts → node/process.d.ts +17 -16
  35. node v16.11/punycode.d.ts → node/punycode.d.ts +1 -1
  36. node v16.11/querystring.d.ts → node/querystring.d.ts +4 -4
  37. node/readline/promises.d.ts +143 -0
  38. node v16.11/readline.d.ts → node/readline.d.ts +140 -30
  39. node v16.11/repl.d.ts → node/repl.d.ts +2 -2
  40. node v16.11/stream/consumers.d.ts → node/stream/consumers.d.ts +2 -14
  41. {node v16.11 → node}/stream/promises.d.ts +0 -0
  42. node v16.11/stream/web.d.ts → node/stream/web.d.ts +3 -65
  43. node v16.11/stream.d.ts → node/stream.d.ts +97 -19
  44. node v16.11/string_decoder.d.ts → node/string_decoder.d.ts +1 -1
  45. node/test.d.ts +314 -0
  46. {node v16.11 → node}/timers/promises.d.ts +0 -0
  47. node v16.11/timers.d.ts → node/timers.d.ts +1 -1
  48. node v16.11/tls.d.ts → node/tls.d.ts +32 -23
  49. node v16.11/trace_events.d.ts → node/trace_events.d.ts +11 -1
  50. node/ts4.8/assert/strict.d.ts +8 -0
  51. node/ts4.8/assert.d.ts +911 -0
  52. node/ts4.8/async_hooks.d.ts +501 -0
  53. node v16.11/buffer.d.ts → node/ts4.8/buffer.d.ts +46 -19
  54. node/ts4.8/child_process.d.ts +1369 -0
  55. node/ts4.8/cluster.d.ts +410 -0
  56. node/ts4.8/console.d.ts +412 -0
  57. node/ts4.8/constants.d.ts +18 -0
  58. node/ts4.8/crypto.d.ts +3964 -0
  59. node/ts4.8/dgram.d.ts +545 -0
  60. node/ts4.8/diagnostics_channel.d.ts +153 -0
  61. node/ts4.8/dns/promises.d.ts +370 -0
  62. node/ts4.8/dns.d.ts +659 -0
  63. node/ts4.8/dom-events.d.ts +126 -0
  64. node/ts4.8/domain.d.ts +170 -0
  65. node/ts4.8/events.d.ts +678 -0
  66. node/ts4.8/fs/promises.d.ts +1138 -0
  67. node/ts4.8/fs.d.ts +3872 -0
  68. node v16.11/globals.d.ts → node/ts4.8/globals.d.ts +14 -4
  69. node/ts4.8/globals.global.d.ts +1 -0
  70. node/ts4.8/http.d.ts +1607 -0
  71. node/ts4.8/http2.d.ts +2134 -0
  72. node/ts4.8/https.d.ts +541 -0
  73. node/ts4.8/index.d.ts +88 -0
  74. node/ts4.8/inspector.d.ts +2741 -0
  75. node/ts4.8/module.d.ts +114 -0
  76. node/ts4.8/net.d.ts +869 -0
  77. node/ts4.8/os.d.ts +466 -0
  78. node/ts4.8/path.d.ts +191 -0
  79. node/ts4.8/perf_hooks.d.ts +625 -0
  80. node/ts4.8/process.d.ts +1482 -0
  81. node/ts4.8/punycode.d.ts +117 -0
  82. node/ts4.8/querystring.d.ts +131 -0
  83. node/ts4.8/readline/promises.d.ts +143 -0
  84. node/ts4.8/readline.d.ts +653 -0
  85. node/ts4.8/repl.d.ts +424 -0
  86. node/ts4.8/stream/consumers.d.ts +12 -0
  87. node/ts4.8/stream/promises.d.ts +42 -0
  88. node/ts4.8/stream/web.d.ts +330 -0
  89. node/ts4.8/stream.d.ts +1340 -0
  90. node/ts4.8/string_decoder.d.ts +67 -0
  91. node/ts4.8/test.d.ts +314 -0
  92. node/ts4.8/timers/promises.d.ts +68 -0
  93. node/ts4.8/timers.d.ts +94 -0
  94. node/ts4.8/tls.d.ts +1028 -0
  95. node/ts4.8/trace_events.d.ts +171 -0
  96. node v16.11/tty.d.ts → node/ts4.8/tty.d.ts +4 -2
  97. node v16.11/url.d.ts → node/ts4.8/url.d.ts +85 -39
  98. node v16.11/util.d.ts → node/ts4.8/util.d.ts +268 -12
  99. node v16.11/v8.d.ts → node/ts4.8/v8.d.ts +21 -3
  100. node v16.11/vm.d.ts → node/ts4.8/vm.d.ts +6 -4
  101. node v16.11/wasi.d.ts → node/ts4.8/wasi.d.ts +1 -1
  102. node v16.11/worker_threads.d.ts → node/ts4.8/worker_threads.d.ts +50 -10
  103. node v16.11/zlib.d.ts → node/ts4.8/zlib.d.ts +1 -1
  104. node/tty.d.ts +206 -0
  105. node/url.d.ts +897 -0
  106. node/util.d.ts +1850 -0
  107. node/v8.d.ts +396 -0
  108. node/vm.d.ts +509 -0
  109. node/wasi.d.ts +158 -0
  110. node/worker_threads.d.ts +689 -0
  111. node/zlib.d.ts +517 -0
@@ -16,7 +16,7 @@
16
16
  *
17
17
  * All file system operations have synchronous, callback, and promise-based
18
18
  * forms, and are accessible using both CommonJS syntax and ES6 Modules (ESM).
19
- * @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/fs.js)
19
+ * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/fs.js)
20
20
  */
21
21
  declare module 'fs' {
22
22
  import * as stream from 'node:stream';
@@ -268,18 +268,22 @@ declare module 'fs' {
268
268
  */
269
269
  export interface StatWatcher extends EventEmitter {
270
270
  /**
271
+ * 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
272
+ * no effect.
273
+ *
274
+ * By default, all `fs.StatWatcher` objects are "ref'ed", making it normally
275
+ * unnecessary to call `watcher.ref()` unless `watcher.unref()` had been
276
+ * called previously.
271
277
  * @since v14.3.0, v12.20.0
272
- * When called, requests that the Node.js event loop not exit so long as the `fs.StatWatcher` is active.
273
- * Calling `watcher.ref()` multiple times will have no effect.
274
- * By default, all `fs.StatWatcher`` objects are "ref'ed", making it normally unnecessary to call `watcher.ref()`
275
- * unless `watcher.unref()` had been called previously.
276
278
  */
277
279
  ref(): this;
278
280
  /**
281
+ * When called, the active `fs.StatWatcher` object will not require the Node.js
282
+ * event loop to remain active. If there is no other activity keeping the
283
+ * event loop running, the process may exit before the `fs.StatWatcher` object's
284
+ * callback is invoked. Calling `watcher.unref()` multiple times will have
285
+ * no effect.
279
286
  * @since v14.3.0, v12.20.0
280
- * When called, the active `fs.StatWatcher`` object will not require the Node.js event loop to remain active.
281
- * If there is no other activity keeping the event loop running, the process may exit before the `fs.StatWatcher`` object's callback is invoked.
282
- * `Calling watcher.unref()` multiple times will have no effect.
283
287
  */
284
288
  unref(): this;
285
289
  }
@@ -1014,8 +1018,10 @@ declare module 'fs' {
1014
1018
  function __promisify__(fd: number, options?: StatOptions): Promise<Stats | BigIntStats>;
1015
1019
  }
1016
1020
  /**
1017
- * Synchronous fstat(2) - Get file status.
1018
- * @param fd A file descriptor.
1021
+ * Retrieves the `fs.Stats` for the file descriptor.
1022
+ *
1023
+ * See the POSIX [`fstat(2)`](http://man7.org/linux/man-pages/man2/fstat.2.html) documentation for more detail.
1024
+ * @since v0.1.95
1019
1025
  */
1020
1026
  export function fstatSync(
1021
1027
  fd: number,
@@ -1030,7 +1036,6 @@ declare module 'fs' {
1030
1036
  }
1031
1037
  ): BigIntStats;
1032
1038
  export function fstatSync(fd: number, options?: StatOptions): Stats | BigIntStats;
1033
-
1034
1039
  /**
1035
1040
  * Retrieves the `fs.Stats` for the symbolic link referred to by the path.
1036
1041
  * 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
@@ -1118,15 +1123,15 @@ declare module 'fs' {
1118
1123
  * ```js
1119
1124
  * import { symlink } from 'fs';
1120
1125
  *
1121
- * symlink('./mew', './example/mewtwo', callback);
1126
+ * symlink('./mew', './mewtwo', callback);
1122
1127
  * ```
1123
1128
  *
1124
- * The above example creates a symbolic link `mewtwo` in the `example` which points
1125
- * to `mew` in the same directory:
1129
+ * The above example creates a symbolic link `mewtwo` which points to `mew` in the
1130
+ * same directory:
1126
1131
  *
1127
1132
  * ```bash
1128
- * $ tree example/
1129
- * example/
1133
+ * $ tree .
1134
+ * .
1130
1135
  * ├── mew
1131
1136
  * └── mewtwo -> ./mew
1132
1137
  * ```
@@ -1390,7 +1395,7 @@ declare module 'fs' {
1390
1395
  * Use `fs.rm(path, { recursive: true, force: true })` instead.
1391
1396
  *
1392
1397
  * If `true`, perform a recursive directory removal. In
1393
- * recursive mode soperations are retried on failure.
1398
+ * recursive mode, operations are retried on failure.
1394
1399
  * @default false
1395
1400
  */
1396
1401
  recursive?: boolean | undefined;
@@ -1996,8 +2001,8 @@ declare module 'fs' {
1996
2001
  export function open(path: PathLike, flags: OpenMode | undefined, mode: Mode | undefined | null, callback: (err: NodeJS.ErrnoException | null, fd: number) => void): void;
1997
2002
  /**
1998
2003
  * Asynchronous open(2) - open and possibly create a file. If the file is created, its mode will be `0o666`.
1999
- * @param [flags='r'] See `support of file system `flags``.
2000
2004
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2005
+ * @param [flags='r'] See `support of file system `flags``.
2001
2006
  */
2002
2007
  export function open(path: PathLike, flags: OpenMode | undefined, callback: (err: NodeJS.ErrnoException | null, fd: number) => void): void;
2003
2008
  /**
@@ -2005,6 +2010,7 @@ declare module 'fs' {
2005
2010
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2006
2011
  */
2007
2012
  export function open(path: PathLike, callback: (err: NodeJS.ErrnoException | null, fd: number) => void): void;
2013
+
2008
2014
  export namespace open {
2009
2015
  /**
2010
2016
  * Asynchronous open(2) - open and possibly create a file.
@@ -2093,8 +2099,7 @@ declare module 'fs' {
2093
2099
  */
2094
2100
  export function fsyncSync(fd: number): void;
2095
2101
  /**
2096
- * Write `buffer` to the file specified by `fd`. If `buffer` is a normal object, it
2097
- * must have an own `toString` function property.
2102
+ * Write `buffer` to the file specified by `fd`.
2098
2103
  *
2099
2104
  * `offset` determines the part of the buffer to be written, and `length` is
2100
2105
  * an integer specifying the number of bytes to write.
@@ -2217,8 +2222,6 @@ declare module 'fs' {
2217
2222
  }>;
2218
2223
  }
2219
2224
  /**
2220
- * If `buffer` is a plain object, it must have an own (not inherited) `toString`function property.
2221
- *
2222
2225
  * For detailed information, see the documentation of the asynchronous version of
2223
2226
  * this API: {@link write}.
2224
2227
  * @since v0.1.21
@@ -2234,6 +2237,23 @@ declare module 'fs' {
2234
2237
  */
2235
2238
  export function writeSync(fd: number, string: string, position?: number | null, encoding?: BufferEncoding | null): number;
2236
2239
  export type ReadPosition = number | bigint;
2240
+ export interface ReadSyncOptions {
2241
+ /**
2242
+ * @default 0
2243
+ */
2244
+ offset?: number | undefined;
2245
+ /**
2246
+ * @default `length of buffer`
2247
+ */
2248
+ length?: number | undefined;
2249
+ /**
2250
+ * @default null
2251
+ */
2252
+ position?: ReadPosition | null | undefined;
2253
+ }
2254
+ export interface ReadAsyncOptions<TBuffer extends NodeJS.ArrayBufferView> extends ReadSyncOptions {
2255
+ buffer?: TBuffer;
2256
+ }
2237
2257
  /**
2238
2258
  * Read data from the file specified by `fd`.
2239
2259
  *
@@ -2259,6 +2279,21 @@ declare module 'fs' {
2259
2279
  position: ReadPosition | null,
2260
2280
  callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: TBuffer) => void
2261
2281
  ): void;
2282
+ /**
2283
+ * Similar to the above `fs.read` function, this version takes an optional `options` object.
2284
+ * If not otherwise specified in an `options` object,
2285
+ * `buffer` defaults to `Buffer.alloc(16384)`,
2286
+ * `offset` defaults to `0`,
2287
+ * `length` defaults to `buffer.byteLength`, `- offset` as of Node 17.6.0
2288
+ * `position` defaults to `null`
2289
+ * @since v12.17.0, 13.11.0
2290
+ */
2291
+ export function read<TBuffer extends NodeJS.ArrayBufferView>(
2292
+ fd: number,
2293
+ options: ReadAsyncOptions<TBuffer>,
2294
+ callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: TBuffer) => void
2295
+ ): void;
2296
+ export function read(fd: number, callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: NodeJS.ArrayBufferView) => void): void;
2262
2297
  export namespace read {
2263
2298
  /**
2264
2299
  * @param fd A file descriptor.
@@ -2277,20 +2312,17 @@ declare module 'fs' {
2277
2312
  bytesRead: number;
2278
2313
  buffer: TBuffer;
2279
2314
  }>;
2280
- }
2281
- export interface ReadSyncOptions {
2282
- /**
2283
- * @default 0
2284
- */
2285
- offset?: number | undefined;
2286
- /**
2287
- * @default `length of buffer`
2288
- */
2289
- length?: number | undefined;
2290
- /**
2291
- * @default null
2292
- */
2293
- position?: ReadPosition | null | undefined;
2315
+ function __promisify__<TBuffer extends NodeJS.ArrayBufferView>(
2316
+ fd: number,
2317
+ options: ReadAsyncOptions<TBuffer>
2318
+ ): Promise<{
2319
+ bytesRead: number;
2320
+ buffer: TBuffer;
2321
+ }>;
2322
+ function __promisify__(fd: number): Promise<{
2323
+ bytesRead: number;
2324
+ buffer: NodeJS.ArrayBufferView;
2325
+ }>;
2294
2326
  }
2295
2327
  /**
2296
2328
  * Returns the number of `bytesRead`.
@@ -2555,8 +2587,6 @@ declare module 'fs' {
2555
2587
  *
2556
2588
  * The `mode` option only affects the newly created file. See {@link open} for more details.
2557
2589
  *
2558
- * If `data` is a plain object, it must have an own (not inherited) `toString`function property.
2559
- *
2560
2590
  * ```js
2561
2591
  * import { writeFile } from 'fs';
2562
2592
  * import { Buffer } from 'buffer';
@@ -2633,8 +2663,6 @@ declare module 'fs' {
2633
2663
  /**
2634
2664
  * Returns `undefined`.
2635
2665
  *
2636
- * If `data` is a plain object, it must have an own (not inherited) `toString`function property.
2637
- *
2638
2666
  * The `mode` option only affects the newly created file. See {@link open} for more details.
2639
2667
  *
2640
2668
  * For detailed information, see the documentation of the asynchronous version of
@@ -2818,6 +2846,52 @@ declare module 'fs' {
2818
2846
  persistent?: boolean | undefined;
2819
2847
  interval?: number | undefined;
2820
2848
  }
2849
+ /**
2850
+ * Watch for changes on `filename`. The callback `listener` will be called each
2851
+ * time the file is accessed.
2852
+ *
2853
+ * The `options` argument may be omitted. If provided, it should be an object. The`options` object may contain a boolean named `persistent` that indicates
2854
+ * whether the process should continue to run as long as files are being watched.
2855
+ * The `options` object may specify an `interval` property indicating how often the
2856
+ * target should be polled in milliseconds.
2857
+ *
2858
+ * The `listener` gets two arguments the current stat object and the previous
2859
+ * stat object:
2860
+ *
2861
+ * ```js
2862
+ * import { watchFile } from 'fs';
2863
+ *
2864
+ * watchFile('message.text', (curr, prev) => {
2865
+ * console.log(`the current mtime is: ${curr.mtime}`);
2866
+ * console.log(`the previous mtime was: ${prev.mtime}`);
2867
+ * });
2868
+ * ```
2869
+ *
2870
+ * These stat objects are instances of `fs.Stat`. If the `bigint` option is `true`,
2871
+ * the numeric values in these objects are specified as `BigInt`s.
2872
+ *
2873
+ * To be notified when the file was modified, not just accessed, it is necessary
2874
+ * to compare `curr.mtimeMs` and `prev.mtimeMs`.
2875
+ *
2876
+ * When an `fs.watchFile` operation results in an `ENOENT` error, it
2877
+ * will invoke the listener once, with all the fields zeroed (or, for dates, the
2878
+ * Unix Epoch). If the file is created later on, the listener will be called
2879
+ * again, with the latest stat objects. This is a change in functionality since
2880
+ * v0.10.
2881
+ *
2882
+ * Using {@link watch} is more efficient than `fs.watchFile` and`fs.unwatchFile`. `fs.watch` should be used instead of `fs.watchFile` and`fs.unwatchFile` when possible.
2883
+ *
2884
+ * When a file being watched by `fs.watchFile()` disappears and reappears,
2885
+ * then the contents of `previous` in the second callback event (the file's
2886
+ * reappearance) will be the same as the contents of `previous` in the first
2887
+ * callback event (its disappearance).
2888
+ *
2889
+ * This happens when:
2890
+ *
2891
+ * * the file is deleted, followed by a restore
2892
+ * * the file is renamed and then renamed a second time back to its original name
2893
+ * @since v0.1.31
2894
+ */
2821
2895
  export function watchFile(
2822
2896
  filename: PathLike,
2823
2897
  options:
@@ -3186,9 +3260,9 @@ declare module 'fs' {
3186
3260
  /**
3187
3261
  * Tests a user's permissions for the file or directory specified by `path`.
3188
3262
  * The `mode` argument is an optional integer that specifies the accessibility
3189
- * checks to be performed. Check `File access constants` for possible values
3190
- * of `mode`. It is possible to create a mask consisting of the bitwise OR of
3191
- * two or more values (e.g. `fs.constants.W_OK | fs.constants.R_OK`).
3263
+ * checks to be performed. `mode` should be either the value `fs.constants.F_OK`or a mask consisting of the bitwise OR of any of `fs.constants.R_OK`,`fs.constants.W_OK`, and `fs.constants.X_OK`
3264
+ * (e.g.`fs.constants.W_OK | fs.constants.R_OK`). Check `File access constants` for
3265
+ * possible values of `mode`.
3192
3266
  *
3193
3267
  * The final argument, `callback`, is a callback function that is invoked with
3194
3268
  * a possible error argument. If any of the accessibility checks fail, the error
@@ -3214,14 +3288,9 @@ declare module 'fs' {
3214
3288
  * console.log(`${file} ${err ? 'is not writable' : 'is writable'}`);
3215
3289
  * });
3216
3290
  *
3217
- * // Check if the file exists in the current directory, and if it is writable.
3218
- * access(file, constants.F_OK | constants.W_OK, (err) => {
3219
- * if (err) {
3220
- * console.error(
3221
- * `${file} ${err.code === 'ENOENT' ? 'does not exist' : 'is read-only'}`);
3222
- * } else {
3223
- * console.log(`${file} exists, and it is writable`);
3224
- * }
3291
+ * // Check if the file is readable and writable.
3292
+ * access(file, constants.R_OK | constants.W_OK, (err) => {
3293
+ * console.log(`${file} ${err ? 'is not' : 'is'} readable and writable`);
3225
3294
  * });
3226
3295
  * ```
3227
3296
  *
@@ -3365,10 +3434,9 @@ declare module 'fs' {
3365
3434
  /**
3366
3435
  * Synchronously tests a user's permissions for the file or directory specified
3367
3436
  * by `path`. The `mode` argument is an optional integer that specifies the
3368
- * accessibility checks to be performed. Check `File access constants` for
3369
- * possible values of `mode`. It is possible to create a mask consisting of
3370
- * the bitwise OR of two or more values
3371
- * (e.g. `fs.constants.W_OK | fs.constants.R_OK`).
3437
+ * accessibility checks to be performed. `mode` should be either the value`fs.constants.F_OK` or a mask consisting of the bitwise OR of any of`fs.constants.R_OK`, `fs.constants.W_OK`, and
3438
+ * `fs.constants.X_OK` (e.g.`fs.constants.W_OK | fs.constants.R_OK`). Check `File access constants` for
3439
+ * possible values of `mode`.
3372
3440
  *
3373
3441
  * If any of the accessibility checks fail, an `Error` will be thrown. Otherwise,
3374
3442
  * the method will return `undefined`.
@@ -3471,9 +3539,9 @@ declare module 'fs' {
3471
3539
  /**
3472
3540
  * `options` may also include a `start` option to allow writing data at some
3473
3541
  * position past the beginning of the file, allowed values are in the
3474
- * \[0, [`Number.MAX_SAFE_INTEGER`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER)\] range. Modifying a file rather than replacing
3475
- * it may require the `flags` option to be set to `r+` rather than the default `w`.
3476
- * The `encoding` can be any one of those accepted by `Buffer`.
3542
+ * \[0, [`Number.MAX_SAFE_INTEGER`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER)\] range. Modifying a file rather than
3543
+ * replacing it may require the `flags` option to be set to `r+` rather than the
3544
+ * default `w`. The `encoding` can be any one of those accepted by `Buffer`.
3477
3545
  *
3478
3546
  * If `autoClose` is set to true (default behavior) on `'error'` or `'finish'`the file descriptor will be closed automatically. If `autoClose` is false,
3479
3547
  * then the file descriptor won't be closed, even if there's an error.
@@ -3723,7 +3791,7 @@ declare module 'fs' {
3723
3791
  export interface StatSyncOptions extends StatOptions {
3724
3792
  throwIfNoEntry?: boolean | undefined;
3725
3793
  }
3726
- export interface CopyOptions {
3794
+ interface CopyOptionsBase {
3727
3795
  /**
3728
3796
  * Dereference symlinks
3729
3797
  * @default false
@@ -3735,11 +3803,6 @@ declare module 'fs' {
3735
3803
  * @default false
3736
3804
  */
3737
3805
  errorOnExist?: boolean;
3738
- /**
3739
- * Function to filter copied files/directories. Return
3740
- * `true` to copy the item, `false` to ignore it.
3741
- */
3742
- filter?(source: string, destination: string): boolean;
3743
3806
  /**
3744
3807
  * Overwrite existing file or directory. _The copy
3745
3808
  * operation will ignore errors if you set this to false and the destination
@@ -3758,6 +3821,25 @@ declare module 'fs' {
3758
3821
  * @default false
3759
3822
  */
3760
3823
  recursive?: boolean;
3824
+ /**
3825
+ * When true, path resolution for symlinks will be skipped
3826
+ * @default false
3827
+ */
3828
+ verbatimSymlinks?: boolean;
3829
+ }
3830
+ export interface CopyOptions extends CopyOptionsBase {
3831
+ /**
3832
+ * Function to filter copied files/directories. Return
3833
+ * `true` to copy the item, `false` to ignore it.
3834
+ */
3835
+ filter?(source: string, destination: string): boolean | Promise<boolean>;
3836
+ }
3837
+ export interface CopySyncOptions extends CopyOptionsBase {
3838
+ /**
3839
+ * Function to filter copied files/directories. Return
3840
+ * `true` to copy the item, `false` to ignore it.
3841
+ */
3842
+ filter?(source: string, destination: string): boolean;
3761
3843
  }
3762
3844
  /**
3763
3845
  * Asynchronously copies the entire directory structure from `src` to `dest`,
@@ -3770,8 +3852,8 @@ declare module 'fs' {
3770
3852
  * @param src source path to copy.
3771
3853
  * @param dest destination path to copy to.
3772
3854
  */
3773
- export function cp(source: string, destination: string, callback: (err: NodeJS.ErrnoException | null) => void): void;
3774
- export function cp(source: string, destination: string, opts: CopyOptions, callback: (err: NodeJS.ErrnoException | null) => void): void;
3855
+ export function cp(source: string | URL, destination: string | URL, callback: (err: NodeJS.ErrnoException | null) => void): void;
3856
+ export function cp(source: string | URL, destination: string | URL, opts: CopyOptions, callback: (err: NodeJS.ErrnoException | null) => void): void;
3775
3857
  /**
3776
3858
  * Synchronously copies the entire directory structure from `src` to `dest`,
3777
3859
  * including subdirectories and files.
@@ -3783,7 +3865,7 @@ declare module 'fs' {
3783
3865
  * @param src source path to copy.
3784
3866
  * @param dest destination path to copy to.
3785
3867
  */
3786
- export function cpSync(source: string, destination: string, opts?: CopyOptions): void;
3868
+ export function cpSync(source: string | URL, destination: string | URL, opts?: CopySyncOptions): void;
3787
3869
  }
3788
3870
  declare module 'node:fs' {
3789
3871
  export * from 'fs';