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

Is it possible to resume a download that fails due to a network failure or similar #125

Open
IamSierraCharlie opened this issue Sep 1, 2020 · 4 comments

Comments

@IamSierraCharlie
Copy link

I've had success with resuming uploads using (as was suggested in a previous question that I asked):

UploadSessionStartAsync
UploadSessionAppendV2Async
UploadSessionFinishAsync

Is the means to resume a download similar? or even possible?
I can download using code such as:

using (DropboxClient dbx = GetAccessToken([myaccesstoken]))
            {
                  using (var response = await dbx.Files.DownloadAsync("/" + file))
                {
                    using (var fileStream = File.Create(localFilePath))
                    {
                        form1.Debuginfo += $"3\r\n";
                        (await response.GetContentAsStreamAsync()).CopyTo(fileStream);
                    }
                }
            }

I then copy it to a file and that works okay.
Could you offer any pointers on how I might resume such a download in the event of a newtwork failure?
I'd expect to have to get a session ID. That leads me to believe that I'd need to create some sort of session for it.
Any direction is greatly appreciated

Steve

@greg-db
Copy link
Contributor

greg-db commented Sep 1, 2020

The Dropbox API v2 .NET SDK unfortunately doesn't offer resumable downloads like this, but I'll pass this along as a feature request. I can't promise if or when that might be implemented though.

@IamSierraCharlie
Copy link
Author

Thanks @greg-db
Just some background on the reason it might be helpful.
The small app that I built, I've been using on remote systems where network connectivity is poor at best.
I've used the SDK's chunk upload feature to get logs and other info from those remote computers (without installing the dropbox client). This method of uploading has greatly improved our success rate in getting the info we need without having to retry multiple times; especially on larger files.
Appreciate that there are no guarantees for the same in downloads. Will just have to wait and see :-)
Regards
Steve

@greg-db
Copy link
Contributor

greg-db commented Sep 2, 2020

Thanks for the context @IamSierraCharlie !

By the way, for reference, while this isn't available in the SDK, the Dropbox API itself does support "Range Retrieval Requests" on "content-download style" endpoints, such as /2/files/download. That's a way to request only a certain portion of a file, and is likely what we would use to implement this feature request in the SDK, if/when we do so.

If it's important for your app, you could consider implementing that directly against the HTTPS endpoints, outside of the SDK functionality.

@IamSierraCharlie
Copy link
Author

IamSierraCharlie commented Sep 4, 2020

Thanks for your diection @greg-db
I've investigated this and have managed some success in getting this to work.
I found it tricky, but in actual fact some of the techniquies used with the sdk seemed to work similarly with the HTTPS endpoints.
It would be great to have the functionality in the SDK for the sake of useability (I prefer to use the SDK if the option was available), but I'm happy with what I've achieved.
Thanks again for your direction - it is greatly appreciated.
Steve

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

2 participants