@types/node 16.18.43 → 16.18.45

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 v16.18/README.md CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for Node.js (https://nodejs.org/).
8
8
  Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node/v16.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Tue, 22 Aug 2023 18:04:31 GMT
11
+ * Last updated: Thu, 24 Aug 2023 21:33:11 GMT
12
12
  * Dependencies: none
13
13
  * Global values: `AbortController`, `AbortSignal`, `__dirname`, `__filename`, `console`, `exports`, `gc`, `global`, `module`, `process`, `require`
14
14
 
node v16.18/fs.d.ts CHANGED
@@ -3397,15 +3397,27 @@ declare module 'fs' {
3397
3397
  fd?: number | promises.FileHandle | undefined;
3398
3398
  mode?: number | undefined;
3399
3399
  autoClose?: boolean | undefined;
3400
- /**
3401
- * @default false
3402
- */
3403
3400
  emitClose?: boolean | undefined;
3404
3401
  start?: number | undefined;
3405
- highWaterMark?: number | undefined;
3402
+ }
3403
+ interface FSImplementation {
3404
+ open?: (...args: any[]) => any;
3405
+ close?: (...args: any[]) => any;
3406
+ }
3407
+ interface CreateReadStreamFSImplementation extends FSImplementation {
3408
+ read: (...args: any[]) => any;
3409
+ }
3410
+ interface CreateWriteStreamFSImplementation extends FSImplementation {
3411
+ write: (...args: any[]) => any;
3412
+ writev?: (...args: any[]) => any;
3406
3413
  }
3407
3414
  interface ReadStreamOptions extends StreamOptions {
3415
+ fs?: CreateReadStreamFSImplementation | null | undefined;
3408
3416
  end?: number | undefined;
3417
+ highWaterMark?: number | undefined;
3418
+ }
3419
+ interface WriteStreamOptions extends StreamOptions {
3420
+ fs?: CreateWriteStreamFSImplementation | null | undefined;
3409
3421
  }
3410
3422
  /**
3411
3423
  * Unlike the 16 kb default `highWaterMark` for a `stream.Readable`, the stream
@@ -3499,7 +3511,7 @@ declare module 'fs' {
3499
3511
  * If `options` is a string, then it specifies the encoding.
3500
3512
  * @since v0.1.31
3501
3513
  */
3502
- export function createWriteStream(path: PathLike, options?: BufferEncoding | StreamOptions): WriteStream;
3514
+ export function createWriteStream(path: PathLike, options?: BufferEncoding | WriteStreamOptions): WriteStream;
3503
3515
  /**
3504
3516
  * Forces all currently queued I/O operations associated with the file to the
3505
3517
  * 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/node",
3
- "version": "16.18.43",
3
+ "version": "16.18.45",
4
4
  "description": "TypeScript definitions for Node.js",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
6
6
  "license": "MIT",
@@ -227,6 +227,6 @@
227
227
  },
228
228
  "scripts": {},
229
229
  "dependencies": {},
230
- "typesPublisherContentHash": "5885c51d920b5d719706eff35d60e83fa52921ff4d4dcfd9516c10685e21da2a",
230
+ "typesPublisherContentHash": "a86f55ee922888fa1bc11bd0d4aab62c1fd96873567c277ad7f8be39328bfeac",
231
231
  "typeScriptVersion": "4.3"
232
232
  }
node v16.18/stream.d.ts CHANGED
@@ -45,6 +45,12 @@ declare module 'stream' {
45
45
  encoding?: BufferEncoding | undefined;
46
46
  read?(this: Readable, size: number): void;
47
47
  }
48
+ interface ArrayOptions {
49
+ /** the maximum concurrent invocations of `fn` to call on the stream at once. **Default: 1**. */
50
+ concurrency?: number;
51
+ /** allows destroying the stream if the signal is aborted. */
52
+ signal?: AbortSignal;
53
+ }
48
54
  /**
49
55
  * @since v0.9.4
50
56
  */
@@ -397,6 +403,33 @@ declare module 'stream' {
397
403
  */
398
404
  wrap(stream: NodeJS.ReadableStream): this;
399
405
  push(chunk: any, encoding?: BufferEncoding): boolean;
406
+ /**
407
+ * The iterator created by this method gives users the option to cancel the destruction
408
+ * of the stream if the `for await...of` loop is exited by `return`, `break`, or `throw`,
409
+ * or if the iterator should destroy the stream if the stream emitted an error during iteration.
410
+ * @since v16.3.0
411
+ * @param options.destroyOnReturn When set to `false`, calling `return` on the async iterator,
412
+ * or exiting a `for await...of` iteration using a `break`, `return`, or `throw` will not destroy the stream.
413
+ * **Default: `true`**.
414
+ */
415
+ iterator(options?: {destroyOnReturn?: boolean}): AsyncIterableIterator<any>;
416
+ /**
417
+ * This method allows mapping over the stream. The *fn* function will be called for every chunk in the stream.
418
+ * If the *fn* function returns a promise - that promise will be `await`ed before being passed to the result stream.
419
+ * @since v17.4.0, v16.14.0
420
+ * @param fn a function to map over every chunk in the stream. Async or not.
421
+ * @returns a stream mapped with the function *fn*.
422
+ */
423
+ map(fn: (data: any, options?: Pick<ArrayOptions, "signal">) => any, options?: ArrayOptions): Readable;
424
+ /**
425
+ * This method allows filtering the stream. For each chunk in the stream the *fn* function will be called
426
+ * and if it returns a truthy value, the chunk will be passed to the result stream.
427
+ * If the *fn* function returns a promise - that promise will be `await`ed.
428
+ * @since v17.4.0, v16.14.0
429
+ * @param fn a function to filter chunks from the stream. Async or not.
430
+ * @returns a stream filtered with the predicate *fn*.
431
+ */
432
+ filter(fn: (data: any, options?: Pick<ArrayOptions, "signal">) => boolean | Promise<boolean>, options?: ArrayOptions): Readable;
400
433
  _destroy(error: Error | null, callback: (error?: Error | null) => void): void;
401
434
  /**
402
435
  * Destroy the stream. Optionally emit an `'error'` event, and emit a `'close'`event (unless `emitClose` is set to `false`). After this call, the readable
@@ -2839,6 +2839,7 @@ declare module 'fs' {
2839
2839
  /**
2840
2840
  * Watch for changes on `filename`. The callback `listener` will be called each time the file is accessed.
2841
2841
  * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
2842
+ * @param listener The callback listener will be called each time the file is accessed.
2842
2843
  */
2843
2844
  export function watchFile(filename: PathLike, listener: StatsListener): StatWatcher;
2844
2845
  /**
@@ -3396,15 +3397,27 @@ declare module 'fs' {
3396
3397
  fd?: number | promises.FileHandle | undefined;
3397
3398
  mode?: number | undefined;
3398
3399
  autoClose?: boolean | undefined;
3399
- /**
3400
- * @default false
3401
- */
3402
3400
  emitClose?: boolean | undefined;
3403
3401
  start?: number | undefined;
3404
- highWaterMark?: number | undefined;
3402
+ }
3403
+ interface FSImplementation {
3404
+ open?: (...args: any[]) => any;
3405
+ close?: (...args: any[]) => any;
3406
+ }
3407
+ interface CreateReadStreamFSImplementation extends FSImplementation {
3408
+ read: (...args: any[]) => any;
3409
+ }
3410
+ interface CreateWriteStreamFSImplementation extends FSImplementation {
3411
+ write: (...args: any[]) => any;
3412
+ writev?: (...args: any[]) => any;
3405
3413
  }
3406
3414
  interface ReadStreamOptions extends StreamOptions {
3415
+ fs?: CreateReadStreamFSImplementation | null | undefined;
3407
3416
  end?: number | undefined;
3417
+ highWaterMark?: number | undefined;
3418
+ }
3419
+ interface WriteStreamOptions extends StreamOptions {
3420
+ fs?: CreateWriteStreamFSImplementation | null | undefined;
3408
3421
  }
3409
3422
  /**
3410
3423
  * Unlike the 16 kb default `highWaterMark` for a `stream.Readable`, the stream
@@ -3498,7 +3511,7 @@ declare module 'fs' {
3498
3511
  * If `options` is a string, then it specifies the encoding.
3499
3512
  * @since v0.1.31
3500
3513
  */
3501
- export function createWriteStream(path: PathLike, options?: BufferEncoding | StreamOptions): WriteStream;
3514
+ export function createWriteStream(path: PathLike, options?: BufferEncoding | WriteStreamOptions): WriteStream;
3502
3515
  /**
3503
3516
  * Forces all currently queued I/O operations associated with the file to the
3504
3517
  * 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