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

Service worker cuts out immediately when network connection is interrupted in FF #340

Open wcroachie opened 4 months ago

wcroachie commented 4 months ago

EDIT - if anyone is interested, I created a much simpler library that essentially does the same thing StreamSaver does here: https://github.com/wcroachie/DiskWriterJS

I'm creating a system for zipping and downloading multiple large files over the course of a long period of time and wanted to make sure that the stream continues waiting idly if the network should cut out for a few minutes every now and then, and to resume downloading when the connection resumes. So I have been testing it by turning off my network connection for a few seconds and then back on again, and seeing whether the stream fails or not.

It seems to behave correctly in chrome, but in FF I get the following error:

Failed to load ‘’. A ServiceWorker intercepted the request and encountered an unexpected error.

Then, when the network connection resumes, I get the following error:

DOMException: The operation was aborted.

And this is after writer.write fails. In chrome, nothing happens, and the service worker continues to run fine when the network connection resumes. Anyways, is there a way of preventing the service worker from failing when the network temporarily cuts out in FF?