Skip to content

doc: add node.js streams references to Web Streams doc #57393

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions doc/api/webstreams.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,19 @@ const stream = new ReadableStream({
})();
```

### Node.js streams interoperability

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:

* [`stream.Readable.toWeb`][]
* [`stream.Readable.fromWeb`][]
* [`stream.Writable.toWeb`][]
* [`stream.Writable.fromWeb`][]
* [`stream.Duplex.toWeb`][]
* [`stream.Duplex.fromWeb`][]

## API

### Class: `ReadableStream`
Expand Down Expand Up @@ -1753,3 +1766,12 @@ text(readable).then((data) => {
[Streams]: stream.md
[WHATWG Streams Standard]: https://streams.spec.whatwg.org/
[`stream.Duplex.fromWeb`]: stream.md#streamduplexfromwebpair-options
[`stream.Duplex.toWeb`]: stream.md#streamduplextowebstreamduplex
[`stream.Duplex`]: stream.md#class-streamduplex
[`stream.Readable.fromWeb`]: stream.md#streamreadablefromwebreadablestream-options
[`stream.Readable.toWeb`]: stream.md#streamreadabletowebstreamreadable-options
[`stream.Readable`]: stream.md#class-streamreadable
[`stream.Writable.fromWeb`]: stream.md#streamwritablefromwebwritablestream-options
[`stream.Writable.toWeb`]: stream.md#streamwritabletowebstreamwritable
[`stream.Writable`]: stream.md#class-streamwritable
Loading