Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restart logic for downloading big file #18

Open
Vaibhav1587 opened this issue Aug 15, 2018 · 5 comments
Open

Restart logic for downloading big file #18

Vaibhav1587 opened this issue Aug 15, 2018 · 5 comments

Comments

@Vaibhav1587
Copy link

Is there any call to download the partial file from the server ?

For ex I have 1GB file and connection got lost on 800MB is there any provision to download the remaining bytes only on next call?

@tobiasKaminsky
Copy link

There is (in general) the possibility to use http range request.
This is working on android with vlc to jump to positions in streaming files.

So it should be possible to do the same here.

@a-schild
Copy link
Owner

Technically we could implement such a thing, but we have the danger that we mix things up.

For example:

  • You start downloading FileA, size 650MB
  • Download is aborted for some reason at 250MB
  • FileA on Server is replaced with another file/content with the same size
  • We now download the remaining 400MB

Now we have a mixup of two files, since it was modified on the server between the two downloads.
Usually when resuming downloads, the client and server compute a hash over the already downloaded part and compare it. When they are the same a resume is allowed, otherwise the client must restart a full download.
I'm not sure if NextCloud has such a thing, or if we can use some other attribute like last changed or similar

@tobiasKaminsky
Copy link

We have eTags that get changed everytime content is modified.

So workflow would be:

  • start downloading, store eTag
  • download fails
  • on restart download, check eTag
  • if eTag is still the same, compute range request, else restart from scratch

@a-schild
Copy link
Owner

a-schild commented Aug 16, 2018

Ok,

so we need to return some sort of "restartableDownload" token in the download API, which stores the file uri/size/eTag, and then can be used to resume download if it's still unchanged.

In the same API change/extension, we could add async download/upload stuff to the library

Patches for this will be accepted ;)

@a-schild
Copy link
Owner

In the 11.3.0 release we introduced the getProperties method to retrieve file/folder metadata.
There is the etag property which allows us to detect the version of the file.
Perhaps checksum can help too, but seems to not be filled in by default

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants