cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Back again with another edition of 'How we use Dropbox', so find out how Emma uses to-do lists to get it all done 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

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

Greg-DB
Dropboxer
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.

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

leoyuan2000
New member | Level 2

Thanks a lot Greg for the reply!

Poll
We love to learn from the educators who use Dropbox. Whether you teach kids, teens, adults or a combination of all three, we want to know what apps and integrations you use with Dropbox to help with teaching. Which of the ones below is your favorite, or most used tool?
Who's talking

Top contributors to this post

  • User avatar
    leoyuan2000 New member | Level 2
  • User avatar
    Greg-DB Dropboxer
What do Dropbox user levels mean?
Need more support?