Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/doc/api
diff options
context:
space:
mode:
authorRobert Nagy <ronagy@icloud.com>2021-07-25 21:01:43 +0300
committerRobert Nagy <ronagy@icloud.com>2021-08-03 11:47:10 +0300
commit533cafcf7e3ab72e98a2478bc69aedfdf06d3a5e (patch)
treef133e3faccacaae26341732b72f8afda2c7535f5 /doc/api
parent51cd4a8c56fee4e4d2bc9fa4c116bd2e1445f087 (diff)
stream: duplexify
PR-URL: https://github.com/nodejs/node/pull/39519 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Diffstat (limited to 'doc/api')
-rw-r--r--doc/api/stream.md28
1 files changed, 28 insertions, 0 deletions
diff --git a/doc/api/stream.md b/doc/api/stream.md
index 312f200e61c..047e1687d2e 100644
--- a/doc/api/stream.md
+++ b/doc/api/stream.md
@@ -2081,6 +2081,34 @@ added: REPLACEME
* `streamWritable` {stream.Writable}
* Returns: {WritableStream}
+### `stream.Duplex.from(src)`
+<!-- YAML
+added: REPLACEME
+-->
+
+* `src` {Stream|Blob|ArrayBuffer|string|Iterable|AsyncIterable|
+ AsyncGeneratorFunction|AsyncFunction|Promise|Object}
+
+A utility method for creating duplex streams.
+
+* `Stream` converts writable stream into writable `Duplex` and readable stream
+ to `Duplex`.
+* `Blob` converts into readable `Duplex`.
+* `string` converts into readable `Duplex`.
+* `ArrayBuffer` converts into readable `Duplex`.
+* `AsyncIterable` converts into a readable `Duplex`. Cannot yield
+ `null`.
+* `AsyncGeneratorFunction` converts into a readable/writable transform
+ `Duplex`. Must take a source `AsyncIterable` as first parameter. Cannot yield
+ `null`.
+* `AsyncFunction` converts into a writable `Duplex`. Must return
+ either `null` or `undefined`
+* `Object ({ writable, readable })` converts `readable` and
+ `writable` into `Stream` and then combines them into `Duplex` where the
+ `Duplex` will write to the `writable` and read from the `readable`.
+* `Promise` converts into readable `Duplex`. Value `null` is ignored.
+* Returns: {stream.Duplex}
+
### `stream.Duplex.fromWeb(pair[, options])`
<!-- YAML
added: REPLACEME