Skip to content

Commit cedc648

Browse files
doc: add node.js streams references to Web Streams doc
1 parent fbe37d5 commit cedc648

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

doc/api/webstreams.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,17 @@ const stream = new ReadableStream({
9191
})();
9292
```
9393

94+
### Node.js streams interoperability
95+
96+
Node.js streams can be converted to web streams and vice versa via the `toWeb` and `fromWeb` methods present on [`stream.Readable`][], [`stream.Writable`][] and [`stream.Duplex`][] objects. For more details refer to the relevant documentation:
97+
98+
* [`stream.Readable.toWeb`][]
99+
* [`stream.Readable.fromWeb`][]
100+
* [`stream.Writable.toWeb`][]
101+
* [`stream.Writable.fromWeb`][]
102+
* [`stream.Duplex.toWeb`][]
103+
* [`stream.Duplex.fromWeb`][]
104+
94105
## API
95106

96107
### Class: `ReadableStream`
@@ -1753,3 +1764,12 @@ text(readable).then((data) => {
17531764
17541765
[Streams]: stream.md
17551766
[WHATWG Streams Standard]: https://streams.spec.whatwg.org/
1767+
[`stream.Duplex.fromWeb`]: stream.md#streamduplexfromwebpair-options
1768+
[`stream.Duplex.toWeb`]: stream.md#streamduplextowebstreamduplex
1769+
[`stream.Duplex`]: stream.md#class-streamduplex
1770+
[`stream.Readable.fromWeb`]: stream.md#streamreadablefromwebreadablestream-options
1771+
[`stream.Readable.toWeb`]: stream.md#streamreadabletowebstreamreadable-options
1772+
[`stream.Readable`]: stream.md#class-streamreadable
1773+
[`stream.Writable.fromWeb`]: stream.md#streamwritablefromwebwritablestream-options
1774+
[`stream.Writable.toWeb`]: stream.md#streamwritabletowebstreamwritable
1775+
[`stream.Writable`]: stream.md#class-streamwritable

0 commit comments

Comments
 (0)