Skip to content

Commit

Permalink
streams: add stream/promises pipeline and finished to doc and end to …
Browse files Browse the repository at this point in the history
…PipelineOptions
  • Loading branch information
marco-ippolito committed Dec 12, 2022
1 parent ef8aa88 commit 4e3ac97
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
3 changes: 3 additions & 0 deletions deps/undici/src/types/dispatcher.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@ declare namespace Dispatcher {
export interface PipelineOptions extends RequestOptions {
/** `true` if the `handler` will return an object stream. Default: `false` */
objectMode?: boolean;
// https://github.com/nodejs/node/issues/34805#issuecomment-1345655205
/** Default: `false` */
end?: boolean;
}
export interface UpgradeOptions {
path: string;
Expand Down
28 changes: 28 additions & 0 deletions doc/api/stream.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,34 @@ functions for streams that return `Promise` objects rather than using
callbacks. The API is accessible via `require('node:stream/promises')`
or `require('node:stream').promises`.

### `stream.pipeline(source[, ...transforms], destination, options)`

### `stream.pipeline(streams, options)`

* `streams` {Stream\[]|Iterable\[]|AsyncIterable\[]|Function\[]}
* `source` {Stream|Iterable|AsyncIterable|Function}
* Returns: {Promise\<Iterable|AsyncIterable>}
* `...transforms` {Stream|Function}
* `source` {AsyncIterable}
* Returns: {Promise<AsyncIterable>}
* `destination` {Stream|Function}
* `source` {AsyncIterable}
* Returns: {Promise<AsyncIterable>}
* `options` {Object}
* `signal` {AbortSignal}
* `end` {boolean}
* Returns: {Promise<void>}

### `stream.finished(stream, options)`

* `stream` {Stream}
* `options` {Object}
* `error` {boolean|undefined}
* `readable` {boolean|undefined}
* `writable` {boolean|undefined}
* `signal`: {AbortSignal|undefined}
* Returns: {Promise<void>}

### Object mode

All streams created by Node.js APIs operate exclusively on strings and `Buffer`
Expand Down

0 comments on commit 4e3ac97

Please sign in to comment.