Skip to content

stream: expose ReadableStreamTee#64195

Open
mcollina wants to merge 1 commit into
nodejs:mainfrom
mcollina:expose-readable-stream-tee
Open

stream: expose ReadableStreamTee#64195
mcollina wants to merge 1 commit into
nodejs:mainfrom
mcollina:expose-readable-stream-tee

Conversation

@mcollina

Copy link
Copy Markdown
Member

Refs: nodejs/undici#5358

Expose ReadableStreamTee() so Fetch body clone can use cloneForBranch2.

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/streams

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. stream Issues and PRs related to the stream subsystem. labels Jun 29, 2026
@mcollina mcollina requested a review from KhafraDev June 29, 2026 10:47
@MattiasBuelens

Copy link
Copy Markdown
Contributor

I don't know if we should be exposing this as a top-level function. At the very least, we should mark ReadableStreamTee() as experimental and guide users towards readableStream.tee() for "common" use cases.

Ideally, we land on a solution in the Streams standard itself. The current proposal is to add an options bag to tee(), so you could write readableStream.tee({ clone: true }). Tracking issue: whatwg/streams#1156.

Signed-off-by: Matteo Collina <hello@matteocollina.com>
@mcollina mcollina force-pushed the expose-readable-stream-tee branch from 4430357 to fb6e605 Compare June 29, 2026 12:39
@KhafraDev

KhafraDev commented Jun 29, 2026

Copy link
Copy Markdown
Member

Ideally, we land on a solution in the Streams standard itself. The current proposal is to add an options bag to tee(), so you could write readableStream.tee({ clone: true }). Tracking issue: whatwg/streams#1156.

This would be great, but it doesn't look like browsers have any interest in implementing it, considering the issue is nearly 5 years old.

@mcollina

Copy link
Copy Markdown
Member Author

@KhafraDev @MattiasBuelens should we expose this verbatim or change the name to webStreams.tee(stream, opts)

@KhafraDev

Copy link
Copy Markdown
Member

ReadableStreamTee might be a little verbose. Honestly the only reason I didn't try implementing this myself was because I don't particularly like the verbose name, but didn't have any better ideas

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-ci PRs that need a full CI run. stream Issues and PRs related to the stream subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants