Re: [whatwg/streams] Possible to undo .pipeTo()? (#1055)

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