cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to use DropboxClient.Files.DownloadAsync() to download a part of a file?

How to use DropboxClient.Files.DownloadAsync() to download a part of a file?

leoyuan2000
New member | Level 2

I'm using Dropbox .net api DropboxClient.Files.DownloadAsync() to download files from my Dropbox account. The API document says it supports file range spec, meaning I can download the first 1000 bytes of a file instead of the whole file, but I couldn't find how to set the range. Can anybody help? Thanks a lot.

 

Sample code here:

 

HttpClient httpClient = new HttpClient(new WebRequestHandler { ReadWriteTimeout = 10 * 1000 })
{
// Specify request level timeout which decides maximum time that can be spent on
// download/upload files.
Timeout = TimeSpan.FromMinutes(20)
};
 
var config = new DropboxClientConfig("myDropboxApp")
{
HttpClient = httpClient
};
 
downloadAgent = new DropboxClient(AccessToken, config);
 
using (var response = await downloadAgent .Files.DownloadAsync(folder + "/" + file))
{
fileSize = response.Response.Size;
const int bufferSize = 1024 * 1024;
...
}

 

2 Replies 2

Greg-DB
Dropbox Staff
The HTTP interface itself for API v2 does support "Range Retrieval Requests", but that's unfortunately not currently implemented in the .NET SDK you're using. I'll send this along as a feature request for that, but I can't promise if/when that would be implemented there.

leoyuan2000
New member | Level 2

Thanks a lot Greg for the reply!

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    leoyuan2000 New member | Level 2
  • User avatar
    Greg-DB Dropbox Staff
What do Dropbox user levels mean?