jimmywarting / StreamSaver.js

StreamSaver writes stream to the filesystem directly asynchronous
https://jimmywarting.github.io/StreamSaver.js/example.html
MIT License
3.95k stars 413 forks source link

Do not end after manually cancel the download #315

Open qianshao3170 opened 1 year ago

qianshao3170 commented 1 year ago

I use the code as below: res.body.pipeTo(fileStream, {preventClose: true}).then(() => {code A}

when i click the browser's built-in cancel download, res still continues to be written to fileStream and execute {code A}

I expect to stop writing and subsequent operations after click cancel download. Since cancel download comes with the browser, I am unable to obtain its trigger events. Is there a good method?