Skip to content

Chunky download #87

Open
Open

Description

@i1yxa

Hi!
I've downloading large files. Connection bandwidth is low. I want to implement download recovery after disconnect and continue download.
Unfortunetly, I've not found how I can specify offset and size part of requested file review.
Can you help me to do it?

Activity

  1. greg-db commented on Oct 4, 2018

    @greg-db
    Contributor

    The API v2 /2/files/download HTTPS endpoint itself does support "Range Retrieval Requests", but that's unfortunately not currently implemented in the Dropbox .NET SDK. I'll send this along as a feature request for that, but I can't promise if/when that would be implemented in the SDK.

    That being the case, you could implement the HTTPS call directly, outside of the SDK, so you can set the desired Range header.

  2. i1yxa commented on Oct 5, 2018

    @i1yxa
    Author

    Hi!
    Just add the code and it will work:

    var uri = "https://content.dropboxapi.com/2/files/download";
    var request = (HttpWebRequest)WebRequest.Create(uri);
    request.Method = "POST";
    request.Headers.Add("Authorization", $"Bearer {_generalCfg.AccessToken}");
    request.Headers.Add("Dropbox-API-Arg", $"{{\"path\": \"{_msg.Request.File}\"}}");
    request.AddRange(_from, _to);
    
  3. i1yxa commented on Oct 5, 2018

    @i1yxa
    Author

    Better way

                      var uri = "https://content.dropboxapi.com/2/files/download";
                      var request = new HttpRequestMessage(HttpMethod.Post, uri);
                      request.Headers.Authorization = new AuthenticationHeaderValue("Bearer",AccessToken);
                      var encodedPath = EncodeNonAsciiCharacters(file.Path); 
                      var args = $"{{\"path\": \"{encodedPath}\"}}";
                      request.Headers.Add("Dropbox-API-Arg", args);
                     
                      request.Headers.Range =
                      new RangeHeaderValue(_msg.Request.Offset, _msg.Request.Offset + _msg.Request.Length - 1);
    
                      var response = await httpClient.SendAsync(request, 
                         HttpCompletionOption.ResponseHeadersRead)
                         .ConfigureAwait(false);
                      response.EnsureSuccessStatusCode();
    
  4. mcdis commented on Nov 14, 2018

    @mcdis

    Any progress?

  5. risforrob commented on Nov 14, 2018

    @risforrob

    Hey all, there is no update on this issue to date.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions