- From: Adam Rice <notifications@github.com>
- Date: Thu, 16 Jul 2020 10:21:46 -0700
- To: whatwg/streams <streams@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Thursday, 16 July 2020 17:21:58 UTC
If the first readable closes when it is done, then this is very easy, just do
```js
await readable1.pipeTo(writable, { preventClose: true });
await readable2.pipeTo(writable);
```
If `readable1` is not so cooperative, you can force the pipe to stop by using `AbortSignal`. Something like
```js
const controller = new AbortController();
const pipePromise = readable1.pipeTo(writable, { preventAbort: true, signal: controller.signal });
// some time later.
controller.abort();
await pipePromise.catch(() => {});
readable2.pipeTo(writable);
```
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/streams/issues/1055#issuecomment-659554774
Received on Thursday, 16 July 2020 17:21:58 UTC