@types/node 16.0.1 → 16.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
node/README.md CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for Node.js (http://nodejs.org/).
8
8
  Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Wed, 07 Jul 2021 16:31:27 GMT
11
+ * Last updated: Fri, 09 Jul 2021 22:01:18 GMT
12
12
  * Dependencies: none
13
13
  * Global values: `AbortController`, `AbortSignal`, `__dirname`, `__filename`, `console`, `exports`, `gc`, `global`, `module`, `process`, `require`
14
14
 
node/async_hooks.d.ts CHANGED
@@ -198,8 +198,7 @@ declare module 'async_hooks' {
198
198
  * I the callback function throws an error, it will be thrown by `run` too. The
199
199
  * stacktrace will not be impacted by this call and the context will be exited.
200
200
  */
201
- // TODO: Apply generic vararg once available
202
- run<R>(store: T, callback: (...args: any[]) => R, ...args: any[]): R;
201
+ run<R, TArgs extends any[]>(store: T, callback: (...args: TArgs) => R, ...args: TArgs): R;
203
202
 
204
203
  /**
205
204
  * This methods runs a function synchronously outside of a context and return its
@@ -213,8 +212,7 @@ declare module 'async_hooks' {
213
212
  * stacktrace will not be impacted by this call and the context will be
214
213
  * re-entered.
215
214
  */
216
- // TODO: Apply generic vararg once available
217
- exit<R>(callback: (...args: any[]) => R, ...args: any[]): R;
215
+ exit<R, TArgs extends any[]>(callback: (...args: TArgs) => R, ...args: TArgs): R;
218
216
 
219
217
  /**
220
218
  * Calling `asyncLocalStorage.enterWith(store)` will transition into the context
node/child_process.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  declare module 'child_process' {
2
- import { BaseEncodingOptions } from 'fs';
2
+ import { ObjectEncodingOptions } from 'fs';
3
3
  import { EventEmitter, Abortable } from 'events';
4
4
  import * as net from 'net';
5
5
  import { Writable, Readable, Stream, Pipe } from 'stream';
@@ -327,7 +327,7 @@ declare module 'child_process' {
327
327
  // fallback if nothing else matches. Worst case is always `string | Buffer`.
328
328
  function exec(
329
329
  command: string,
330
- options: (BaseEncodingOptions & ExecOptions) | undefined | null,
330
+ options: (ObjectEncodingOptions & ExecOptions) | undefined | null,
331
331
  callback?: (error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void,
332
332
  ): ChildProcess;
333
333
 
@@ -341,7 +341,7 @@ declare module 'child_process' {
341
341
  function __promisify__(command: string, options: { encoding: "buffer" | null } & ExecOptions): PromiseWithChild<{ stdout: Buffer, stderr: Buffer }>;
342
342
  function __promisify__(command: string, options: { encoding: BufferEncoding } & ExecOptions): PromiseWithChild<{ stdout: string, stderr: string }>;
343
343
  function __promisify__(command: string, options: ExecOptions): PromiseWithChild<{ stdout: string, stderr: string }>;
344
- function __promisify__(command: string, options?: (BaseEncodingOptions & ExecOptions) | null): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>;
344
+ function __promisify__(command: string, options?: (ObjectEncodingOptions & ExecOptions) | null): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>;
345
345
  }
346
346
 
347
347
  interface ExecFileOptions extends CommonOptions, Abortable {
@@ -363,9 +363,9 @@ declare module 'child_process' {
363
363
  type ExecFileException = ExecException & NodeJS.ErrnoException;
364
364
 
365
365
  function execFile(file: string): ChildProcess;
366
- function execFile(file: string, options: (BaseEncodingOptions & ExecFileOptions) | undefined | null): ChildProcess;
366
+ function execFile(file: string, options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null): ChildProcess;
367
367
  function execFile(file: string, args?: ReadonlyArray<string> | null): ChildProcess;
368
- function execFile(file: string, args: ReadonlyArray<string> | undefined | null, options: (BaseEncodingOptions & ExecFileOptions) | undefined | null): ChildProcess;
368
+ function execFile(file: string, args: ReadonlyArray<string> | undefined | null, options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null): ChildProcess;
369
369
 
370
370
  // no `options` definitely means stdout/stderr are `string`.
371
371
  function execFile(file: string, callback: (error: ExecFileException | null, stdout: string, stderr: string) => void): ChildProcess;
@@ -415,13 +415,13 @@ declare module 'child_process' {
415
415
  // fallback if nothing else matches. Worst case is always `string | Buffer`.
416
416
  function execFile(
417
417
  file: string,
418
- options: (BaseEncodingOptions & ExecFileOptions) | undefined | null,
418
+ options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null,
419
419
  callback: ((error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void) | undefined | null,
420
420
  ): ChildProcess;
421
421
  function execFile(
422
422
  file: string,
423
423
  args: ReadonlyArray<string> | undefined | null,
424
- options: (BaseEncodingOptions & ExecFileOptions) | undefined | null,
424
+ options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null,
425
425
  callback: ((error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void) | undefined | null,
426
426
  ): ChildProcess;
427
427
 
@@ -441,11 +441,11 @@ declare module 'child_process' {
441
441
  ): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>;
442
442
  function __promisify__(file: string, options: ExecFileOptions): PromiseWithChild<{ stdout: string, stderr: string }>;
443
443
  function __promisify__(file: string, args: ReadonlyArray<string> | undefined | null, options: ExecFileOptions): PromiseWithChild<{ stdout: string, stderr: string }>;
444
- function __promisify__(file: string, options: (BaseEncodingOptions & ExecFileOptions) | undefined | null): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>;
444
+ function __promisify__(file: string, options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>;
445
445
  function __promisify__(
446
446
  file: string,
447
447
  args: ReadonlyArray<string> | undefined | null,
448
- options: (BaseEncodingOptions & ExecFileOptions) | undefined | null,
448
+ options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null,
449
449
  ): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>;
450
450
  }
451
451
 
@@ -488,7 +488,7 @@ declare module 'child_process' {
488
488
  function spawnSync(command: string, args?: ReadonlyArray<string>, options?: SpawnSyncOptionsWithBufferEncoding): SpawnSyncReturns<Buffer>;
489
489
  function spawnSync(command: string, args?: ReadonlyArray<string>, options?: SpawnSyncOptions): SpawnSyncReturns<Buffer>;
490
490
 
491
- interface CommonExecOptions extends ProcessEnvOptions {
491
+ interface CommonExecOptions extends CommonOptions {
492
492
  input?: string | NodeJS.ArrayBufferView | undefined;
493
493
  stdio?: StdioOptions | undefined;
494
494
  killSignal?: NodeJS.Signals | number | undefined;
node/crypto.d.ts CHANGED
@@ -391,7 +391,7 @@ declare module 'crypto' {
391
391
  function createPublicKey(key: PublicKeyInput | string | Buffer | KeyObject | JsonWebKeyInput): KeyObject;
392
392
  function createSecretKey(key: NodeJS.ArrayBufferView): KeyObject;
393
393
 
394
- function createSign(algorithm: string, options?: stream.WritableOptions): Signer;
394
+ function createSign(algorithm: string, options?: stream.WritableOptions): Sign;
395
395
 
396
396
  type DSAEncoding = 'der' | 'ieee-p1363';
397
397
 
@@ -415,11 +415,11 @@ declare module 'crypto' {
415
415
 
416
416
  type KeyLike = string | Buffer | KeyObject;
417
417
 
418
- class Signer extends stream.Writable {
418
+ class Sign extends stream.Writable {
419
419
  private constructor();
420
420
 
421
- update(data: BinaryLike): Signer;
422
- update(data: string, input_encoding: Encoding): Signer;
421
+ update(data: BinaryLike): this;
422
+ update(data: string, input_encoding: Encoding): this;
423
423
  sign(private_key: KeyLike | SignKeyObjectInput | SignPrivateKeyInput): Buffer;
424
424
  sign(
425
425
  private_key: KeyLike | SignKeyObjectInput | SignPrivateKeyInput,
@@ -1363,8 +1363,6 @@ declare module 'crypto' {
1363
1363
 
1364
1364
  function secureHeapUsed(): SecureHeapUsage;
1365
1365
 
1366
- // TODO: X509Certificate
1367
-
1368
1366
  interface RandomUUIDOptions {
1369
1367
  /**
1370
1368
  * By default, to improve performance,
@@ -1586,6 +1584,10 @@ declare module 'crypto' {
1586
1584
  * Checks the primality of the candidate.
1587
1585
  */
1588
1586
  function checkPrimeSync(value: LargeNumberLike, options?: CheckPrimeOptions): boolean;
1587
+
1588
+ namespace webcrypto {
1589
+ class CryptoKey {} // placeholder
1590
+ }
1589
1591
  }
1590
1592
 
1591
1593
  declare module 'node:crypto' {
node/fs/promises.d.ts CHANGED
@@ -14,13 +14,40 @@ declare module 'fs/promises' {
14
14
  Dirent,
15
15
  OpenDirOptions,
16
16
  Dir,
17
- BaseEncodingOptions,
17
+ ObjectEncodingOptions,
18
18
  BufferEncodingOption,
19
19
  OpenMode,
20
20
  Mode,
21
21
  WatchOptions,
22
22
  } from 'fs';
23
23
 
24
+ interface FlagAndOpenMode {
25
+ mode?: Mode | undefined;
26
+ flag?: OpenMode | undefined;
27
+ }
28
+
29
+ interface FileReadResult<T extends ArrayBufferView> {
30
+ bytesRead: number;
31
+ buffer: T;
32
+ }
33
+
34
+ interface FileReadOptions<T extends ArrayBufferView = Buffer> {
35
+ /**
36
+ * @default `Buffer.alloc(0xffff)`
37
+ */
38
+ buffer?: T;
39
+ /**
40
+ * @default 0
41
+ */
42
+ offset?: number | null;
43
+ /**
44
+ * @default `buffer.byteLength`
45
+ */
46
+ length?: number | null;
47
+ position?: number | null;
48
+ }
49
+
50
+ // TODO: Add `EventEmitter` close
24
51
  interface FileHandle {
25
52
  /**
26
53
  * Gets the file descriptor for this file handle.
@@ -37,7 +64,7 @@ declare module 'fs/promises' {
37
64
  * If `mode` is a string, it is parsed as an octal integer.
38
65
  * If `flag` is not supplied, the default of `'a'` is used.
39
66
  */
40
- appendFile(data: string | Uint8Array, options?: BaseEncodingOptions & { mode?: Mode | undefined, flag?: OpenMode | undefined } | BufferEncoding | null): Promise<void>;
67
+ appendFile(data: string | Uint8Array, options?: ObjectEncodingOptions & FlagAndOpenMode | BufferEncoding | null): Promise<void>;
41
68
 
42
69
  /**
43
70
  * Asynchronous fchown(2) - Change ownership of a file.
@@ -68,8 +95,8 @@ declare module 'fs/promises' {
68
95
  * @param length The number of bytes to read.
69
96
  * @param position The offset from the beginning of the file from which data should be read. If `null`, data will be read from the current position.
70
97
  */
71
- read<TBuffer extends Uint8Array>(buffer: TBuffer, offset?: number | null, length?: number | null, position?: number | null): Promise<{ bytesRead: number, buffer: TBuffer }>;
72
-
98
+ read<T extends ArrayBufferView>(buffer: T, offset?: number | null, length?: number | null, position?: number | null): Promise<FileReadResult<T>>;
99
+ read<T extends ArrayBufferView = Buffer>(options?: FileReadOptions<T>): Promise<FileReadResult<T>>;
73
100
  /**
74
101
  * Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically.
75
102
  * The `FileHandle` must have been opened for reading.
@@ -92,7 +119,7 @@ declare module 'fs/promises' {
92
119
  * @param options An object that may contain an optional flag.
93
120
  * If a flag is not provided, it defaults to `'r'`.
94
121
  */
95
- readFile(options?: BaseEncodingOptions & { flag?: OpenMode | undefined } | BufferEncoding | null): Promise<string | Buffer>;
122
+ readFile(options?: ObjectEncodingOptions & { flag?: OpenMode | undefined } | BufferEncoding | null): Promise<string | Buffer>;
96
123
 
97
124
  /**
98
125
  * Asynchronous fstat(2) - Get file status.
@@ -146,7 +173,7 @@ declare module 'fs/promises' {
146
173
  * If `mode` is a string, it is parsed as an octal integer.
147
174
  * If `flag` is not supplied, the default of `'w'` is used.
148
175
  */
149
- writeFile(data: string | Uint8Array, options?: BaseEncodingOptions & { mode?: Mode | undefined, flag?: OpenMode | undefined } & Abortable | BufferEncoding | null): Promise<void>;
176
+ writeFile(data: string | Uint8Array, options?: ObjectEncodingOptions & FlagAndOpenMode & Abortable | BufferEncoding | null): Promise<void>;
150
177
 
151
178
  /**
152
179
  * See `fs.writev` promisified version.
@@ -192,50 +219,6 @@ declare module 'fs/promises' {
192
219
  */
193
220
  function open(path: PathLike, flags: string | number, mode?: Mode): Promise<FileHandle>;
194
221
 
195
- /**
196
- * Asynchronously reads data from the file referenced by the supplied `FileHandle`.
197
- * @param handle A `FileHandle`.
198
- * @param buffer The buffer that the data will be written to.
199
- * @param offset The offset in the buffer at which to start writing.
200
- * @param length The number of bytes to read.
201
- * @param position The offset from the beginning of the file from which data should be read. If
202
- * `null`, data will be read from the current position.
203
- */
204
- function read<TBuffer extends Uint8Array>(
205
- handle: FileHandle,
206
- buffer: TBuffer,
207
- offset?: number | null,
208
- length?: number | null,
209
- position?: number | null,
210
- ): Promise<{ bytesRead: number, buffer: TBuffer }>;
211
-
212
- /**
213
- * Asynchronously writes `buffer` to the file referenced by the supplied `FileHandle`.
214
- * It is unsafe to call `fsPromises.write()` multiple times on the same file without waiting for the `Promise`
215
- * to be resolved (or rejected). For this scenario, `fs.createWriteStream` is strongly recommended.
216
- * @param handle A `FileHandle`.
217
- * @param buffer The buffer that the data will be written to.
218
- * @param offset The part of the buffer to be written. If not supplied, defaults to `0`.
219
- * @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`.
220
- * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
221
- */
222
- function write<TBuffer extends Uint8Array>(
223
- handle: FileHandle,
224
- buffer: TBuffer,
225
- offset?: number | null,
226
- length?: number | null, position?: number | null): Promise<{ bytesWritten: number, buffer: TBuffer }>;
227
-
228
- /**
229
- * Asynchronously writes `string` to the file referenced by the supplied `FileHandle`.
230
- * It is unsafe to call `fsPromises.write()` multiple times on the same file without waiting for the `Promise`
231
- * to be resolved (or rejected). For this scenario, `fs.createWriteStream` is strongly recommended.
232
- * @param handle A `FileHandle`.
233
- * @param string A string to write.
234
- * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
235
- * @param encoding The expected string encoding.
236
- */
237
- function write(handle: FileHandle, string: string, position?: number | null, encoding?: BufferEncoding | null): Promise<{ bytesWritten: number, buffer: string }>;
238
-
239
222
  /**
240
223
  * Asynchronous rename(2) - Change the name or location of a file or directory.
241
224
  * @param oldPath A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -252,13 +235,6 @@ declare module 'fs/promises' {
252
235
  */
253
236
  function truncate(path: PathLike, len?: number): Promise<void>;
254
237
 
255
- /**
256
- * Asynchronous ftruncate(2) - Truncate a file to a specified length.
257
- * @param handle A `FileHandle`.
258
- * @param len If not specified, defaults to `0`.
259
- */
260
- function ftruncate(handle: FileHandle, len?: number): Promise<void>;
261
-
262
238
  /**
263
239
  * Asynchronous rmdir(2) - delete a directory.
264
240
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -270,18 +246,6 @@ declare module 'fs/promises' {
270
246
  */
271
247
  function rm(path: PathLike, options?: RmOptions): Promise<void>;
272
248
 
273
- /**
274
- * Asynchronous fdatasync(2) - synchronize a file's in-core state with storage device.
275
- * @param handle A `FileHandle`.
276
- */
277
- function fdatasync(handle: FileHandle): Promise<void>;
278
-
279
- /**
280
- * Asynchronous fsync(2) - synchronize a file's in-core state with the underlying storage device.
281
- * @param handle A `FileHandle`.
282
- */
283
- function fsync(handle: FileHandle): Promise<void>;
284
-
285
249
  /**
286
250
  * Asynchronous mkdir(2) - create a directory.
287
251
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -311,7 +275,7 @@ declare module 'fs/promises' {
311
275
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
312
276
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
313
277
  */
314
- function readdir(path: PathLike, options?: BaseEncodingOptions & { withFileTypes?: false | undefined } | BufferEncoding | null): Promise<string[]>;
278
+ function readdir(path: PathLike, options?: ObjectEncodingOptions & { withFileTypes?: false | undefined } | BufferEncoding | null): Promise<string[]>;
315
279
 
316
280
  /**
317
281
  * Asynchronous readdir(3) - read a directory.
@@ -325,21 +289,21 @@ declare module 'fs/promises' {
325
289
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
326
290
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
327
291
  */
328
- function readdir(path: PathLike, options?: BaseEncodingOptions & { withFileTypes?: false | undefined } | BufferEncoding | null): Promise<string[] | Buffer[]>;
292
+ function readdir(path: PathLike, options?: ObjectEncodingOptions & { withFileTypes?: false | undefined } | BufferEncoding | null): Promise<string[] | Buffer[]>;
329
293
 
330
294
  /**
331
295
  * Asynchronous readdir(3) - read a directory.
332
296
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
333
297
  * @param options If called with `withFileTypes: true` the result data will be an array of Dirent.
334
298
  */
335
- function readdir(path: PathLike, options: BaseEncodingOptions & { withFileTypes: true }): Promise<Dirent[]>;
299
+ function readdir(path: PathLike, options: ObjectEncodingOptions & { withFileTypes: true }): Promise<Dirent[]>;
336
300
 
337
301
  /**
338
302
  * Asynchronous readlink(2) - read value of a symbolic link.
339
303
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
340
304
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
341
305
  */
342
- function readlink(path: PathLike, options?: BaseEncodingOptions | BufferEncoding | null): Promise<string>;
306
+ function readlink(path: PathLike, options?: ObjectEncodingOptions | BufferEncoding | null): Promise<string>;
343
307
 
344
308
  /**
345
309
  * Asynchronous readlink(2) - read value of a symbolic link.
@@ -353,7 +317,7 @@ declare module 'fs/promises' {
353
317
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
354
318
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
355
319
  */
356
- function readlink(path: PathLike, options?: BaseEncodingOptions | string | null): Promise<string | Buffer>;
320
+ function readlink(path: PathLike, options?: ObjectEncodingOptions | string | null): Promise<string | Buffer>;
357
321
 
358
322
  /**
359
323
  * Asynchronous symlink(2) - Create a new symbolic link to an existing file.
@@ -393,13 +357,6 @@ declare module 'fs/promises' {
393
357
  */
394
358
  function unlink(path: PathLike): Promise<void>;
395
359
 
396
- /**
397
- * Asynchronous fchmod(2) - Change permissions of a file.
398
- * @param handle A `FileHandle`.
399
- * @param mode A file mode. If a string is passed, it is parsed as an octal integer.
400
- */
401
- function fchmod(handle: FileHandle, mode: Mode): Promise<void>;
402
-
403
360
  /**
404
361
  * Asynchronous chmod(2) - Change permissions of a file.
405
362
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -430,12 +387,6 @@ declare module 'fs/promises' {
430
387
  */
431
388
  function lutimes(path: PathLike, atime: string | number | Date, mtime: string | number | Date): Promise<void>;
432
389
 
433
- /**
434
- * Asynchronous fchown(2) - Change ownership of a file.
435
- * @param handle A `FileHandle`.
436
- */
437
- function fchown(handle: FileHandle, uid: number, gid: number): Promise<void>;
438
-
439
390
  /**
440
391
  * Asynchronous chown(2) - Change ownership of a file.
441
392
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -450,20 +401,12 @@ declare module 'fs/promises' {
450
401
  */
451
402
  function utimes(path: PathLike, atime: string | number | Date, mtime: string | number | Date): Promise<void>;
452
403
 
453
- /**
454
- * Asynchronously change file timestamps of the file referenced by the supplied `FileHandle`.
455
- * @param handle A `FileHandle`.
456
- * @param atime The last access time. If a string is provided, it will be coerced to number.
457
- * @param mtime The last modified time. If a string is provided, it will be coerced to number.
458
- */
459
- function futimes(handle: FileHandle, atime: string | number | Date, mtime: string | number | Date): Promise<void>;
460
-
461
404
  /**
462
405
  * Asynchronous realpath(3) - return the canonicalized absolute pathname.
463
406
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
464
407
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
465
408
  */
466
- function realpath(path: PathLike, options?: BaseEncodingOptions | BufferEncoding | null): Promise<string>;
409
+ function realpath(path: PathLike, options?: ObjectEncodingOptions | BufferEncoding | null): Promise<string>;
467
410
 
468
411
  /**
469
412
  * Asynchronous realpath(3) - return the canonicalized absolute pathname.
@@ -477,14 +420,14 @@ declare module 'fs/promises' {
477
420
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
478
421
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
479
422
  */
480
- function realpath(path: PathLike, options?: BaseEncodingOptions | BufferEncoding | null): Promise<string | Buffer>;
423
+ function realpath(path: PathLike, options?: ObjectEncodingOptions | BufferEncoding | null): Promise<string | Buffer>;
481
424
 
482
425
  /**
483
426
  * Asynchronously creates a unique temporary directory.
484
427
  * Generates six random characters to be appended behind a required `prefix` to create a unique temporary directory.
485
428
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
486
429
  */
487
- function mkdtemp(prefix: string, options?: BaseEncodingOptions | BufferEncoding | null): Promise<string>;
430
+ function mkdtemp(prefix: string, options?: ObjectEncodingOptions | BufferEncoding | null): Promise<string>;
488
431
 
489
432
  /**
490
433
  * Asynchronously creates a unique temporary directory.
@@ -498,7 +441,7 @@ declare module 'fs/promises' {
498
441
  * Generates six random characters to be appended behind a required `prefix` to create a unique temporary directory.
499
442
  * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
500
443
  */
501
- function mkdtemp(prefix: string, options?: BaseEncodingOptions | BufferEncoding | null): Promise<string | Buffer>;
444
+ function mkdtemp(prefix: string, options?: ObjectEncodingOptions | BufferEncoding | null): Promise<string | Buffer>;
502
445
 
503
446
  /**
504
447
  * Asynchronously writes data to a file, replacing the file if it already exists.
@@ -516,8 +459,8 @@ declare module 'fs/promises' {
516
459
  function writeFile(
517
460
  path: PathLike | FileHandle,
518
461
  data: string | NodeJS.ArrayBufferView | Iterable<string | NodeJS.ArrayBufferView> | AsyncIterable<string | NodeJS.ArrayBufferView> | Stream,
519
- options?: BaseEncodingOptions & { mode?: Mode | undefined, flag?: OpenMode | undefined } & Abortable | BufferEncoding | null
520
- ): Promise<void>;
462
+ options?: ObjectEncodingOptions & { mode?: Mode | undefined, flag?: OpenMode | undefined } & Abortable | BufferEncoding | null
463
+ ): Promise<void>;
521
464
 
522
465
  /**
523
466
  * Asynchronously append data to a file, creating the file if it does not exist.
@@ -534,7 +477,7 @@ declare module 'fs/promises' {
534
477
  function appendFile(
535
478
  path: PathLike | FileHandle,
536
479
  data: string | Uint8Array,
537
- options?: BaseEncodingOptions & { mode?: Mode | undefined, flag?: OpenMode | undefined } | BufferEncoding | null
480
+ options?: ObjectEncodingOptions & FlagAndOpenMode | BufferEncoding | null,
538
481
  ): Promise<void>;
539
482
 
540
483
  /**
@@ -562,7 +505,7 @@ declare module 'fs/promises' {
562
505
  * @param options An object that may contain an optional flag.
563
506
  * If a flag is not provided, it defaults to `'r'`.
564
507
  */
565
- function readFile(path: PathLike | FileHandle, options?: BaseEncodingOptions & Abortable & { flag?: OpenMode | undefined } | BufferEncoding | null): Promise<string | Buffer>;
508
+ function readFile(path: PathLike | FileHandle, options?: ObjectEncodingOptions & Abortable & { flag?: OpenMode | undefined } | BufferEncoding | null): Promise<string | Buffer>;
566
509
 
567
510
  function opendir(path: string, options?: OpenDirOptions): Promise<Dir>;
568
511