We Want to Hear From You! What Do You Want to See on the Community? Tell us here!
Forum Discussion
leoyuan2000
9 years agoNew member | Level 2
How to use DropboxClient.Files.DownloadAsync() to download a part of a file?
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
- Greg-DB9 years ago
Dropbox Community Moderator
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. - leoyuan20009 years agoNew member | Level 2
Thanks a lot Greg for the reply!
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.6,037 PostsLatest Activity: 6 hours ago
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!