Webextension: Retry failed download

Is there a way using webextension api to retry a failed download (for reasons like loss of network connectivity)? I looked through history and downloads but couldn’t find a way.

I mean, I can get a list of DownloadItems with downloads.search()but was unable to find a way to restart.

downloads.downloads() only seems to start a fresh download and downloads.resume()doesn’t seem to work for a failed download.

That would seem like there is not then. I hadn’t followed the conversation in the add-ons chat room very closely, but you may want to file a bug to add resuming as an API feature: https://bugzilla.mozilla.org/enter_bug.cgi?product=WebExtensions

Someone has already requested the feature it seems. https://bugzilla.mozilla.org/show_bug.cgi?id=1467059

Not sure what became of it though.

Yet some chrome extensions seem to provide this feature. Like https://chrome.google.com/webstore/detail/auto-resume-downloads/cklhieaaomjcmlaeopmeidpfdjjogjaf.

And I heard people saying ‘down them all’ has it as well.

Ah yes, the ones that can read documentation always win:

1 Like

But does downloads.resume() work for failed downloads? I tried it when a download had failed due to network failure (downloads.InterruptReason) but it wouldn’t work.

Maybe downloads.resume() will work only if the download is paused and not failed? Like with the pause button or downloads.pause().

It is exactly the API the extension you linked above uses. Maybe the bug then is that it doesn’t resume failed downloads in Firefox.

Okay. Thanks for helping out!

Also not all downloads can be resumed. Server needs to support this as well. I don’t know how it’s called though.

Well, if a download fails and the server doesn’t support resuming from offsets/a certain chunk, retrying would just restart the download, which is the expectation here.

Current conditions: When a download fails I can usually resume it if I catch the failure within a coupla minutes.
Assumption: the resume function presumes a paused download. So if it works the system is presenting the download as paused. However after a certain amount of time that flag is changed to “Failed” and the resume function no longer works. Obviously the server also plays a role.
Question.: What happens if we send the server a resume request repeatedly at some interval until the download resumes . The server will presume their is a user request.

“Downthemall”.app purports to do this, but my download (approx. 1.5 G) is still not completing. Large torrents are not a problem

Firefpx resume button actually does resume the download at the point it stopped, but only if i sit and watch it which, is not practical.