ReadableStreamTee(stream[, cloneForBranch2])
稳定性: 1 - 实验性
stream<ReadableStream>cloneForBranch2<boolean> 当true时,进入第二分支的块会从进入第一分支的块克隆。默认值:false。- 返回:<ReadableStream[]> 两个<ReadableStream>分支。
在 stream 上运行 WHATWG 的 ReadableStreamTee 抽象操作。
🌐 Runs the WHATWG ReadableStreamTee abstract operation on stream.
只有当 cloneForBranch2 是 true 时,这与 readableStream.tee() 才会不同。tee() 方法总是传递 false,而其他网页平台规范,比如 Fetch body 克隆,会传递 true,这样第二个分支就会收到克隆的块,并且一个分支的使用不会改变另一个分支看到的块。
🌐 This differs from readableStream.tee() only when cloneForBranch2 is
true. The tee() method always passes false, while other web platform
specifications, such as Fetch body cloning, pass true so that the second
branch receives cloned chunks and consumption of one branch cannot mutate chunks
seen by the other.