(
readable: ReadableStream<R>,
strategy?: QueuingStrategy<R>,
)
| 68 | } |
| 69 | |
| 70 | wrapReadable( |
| 71 | readable: ReadableStream<R>, |
| 72 | strategy?: QueuingStrategy<R>, |
| 73 | ): WrapReadableStream<R> { |
| 74 | return new WrapReadableStream<R>( |
| 75 | { |
| 76 | start: (controller) => { |
| 77 | this.#readableControllers.push(controller); |
| 78 | return readable; |
| 79 | }, |
| 80 | cancel: async () => { |
| 81 | // cancel means the local peer wants to close the connection. |
| 82 | await this.close(); |
| 83 | }, |
| 84 | close: async () => { |
| 85 | // stream end means the remote peer closed the connection first. |
| 86 | await this.dispose(); |
| 87 | }, |
| 88 | }, |
| 89 | strategy, |
| 90 | ); |
| 91 | } |
| 92 | |
| 93 | createWritable(stream: WritableStream<W>): WritableStream<W> { |
| 94 | const writer = stream.getWriter(); |
no test coverage detected