Is it possible to implement any recovery / resumption of file downloads in a browser?

A project is a servlet to which people can upload files via HTTP POST. This is followed by web pages providing an interface to start the download. We have more or less full control over the servlet and web pages, but do not want to impose any restrictions on the client, not being a fairly modern browser with Javascript. No Java applets, etc.

Files can potentially be large, and mobile devices on less reliable networks are a possible use case. Some people in the project require the ability to resume downloading if the network connection is down. I do not think this is possible with simple HTTP and Javascript in the browser, but I would like you to be proved wrong.

Any suggestions?

+3
source share
3 answers

With your current restrictions, no.

(Maybe there’s a tiny chance that using an HTML5 api file may be able to do this. Maybe someone more knowledgeable can comment, because I usually can’t do the headers or tails of the technical specifications from w3c: http: // www. w3.org/TR/file-upload/ )

+1
source

Not with Plain Ol 'JS. It does not have access to the file system, not even the file added to the control input type=file, and therefore it cannot manipulate data and upload via XHR.

You will need to explore an alternative to Flash or Java.

+1
source

Firefox 3.6 FileReader, , , . , , .

This will not be particularly useful for a large file, since you might have damaged the browser anyway due to the memory allocation that it needed.

https://developer.mozilla.org/en/DOM/FileReader

0
source

Source: https://habr.com/ru/post/1742974/


All Articles