Curious about A, B, C, and D drives? Learn what they mean and how to use them effectively with Dropbox in this handy guide! - check it out now!
Forum Discussion
gagsbh
7 years agoHelpful | Level 5
Large File Download
Hello,
I used Dropbox SDK for .NET to download a large file of size 1.3 GB but the program hung.
using (var response = await dbx.Files.DownloadAsync(path + "/" + file))
{
byte[] buffer = await response.GetContentAsByteArrayAsync();
}
I then used Dropbox REST API - "https://content.dropboxapi.com/2/files/download"
with Authorization and Dropbox-API-Arg (with path as argument) as headers.
For smaller files the Rest Api worked, but for the 1.3 GB file download, the program threw "Out of Memory Exception".
How do I perform a download of such a larger file with size > 1GB.
Thanks,
Gagan
- I appreciate the help. Changing the URL or requesting desktop sites on a mobile phone might work, but it’s cumbersome as a workaround. As such, in iOS, shared links to audio files, links originally created by Dropbox, will autoplay when opened in the app. That is the default behavior that ultimately emerges. I’ll take the opportunity to request a global “off” button for autoplay in the Dropbox iOS app.
2 Replies
Sort By
- Greg-DB
Dropbox Staff
You appear to be trying to read the entirety of the contents into memory, which is likely to fail for large files like this.
You'll probably want to use GetContentAsStreamAsync in the SDK (instead of GetContentAsByteArrayAsync), so you can access the contents via a stream, instead of reading it all into memory:
https://dropbox.github.io/dropbox-sdk-dotnet/html/M_Dropbox_Api_Stone_IDownloadResponse_1_GetContentAsStreamAsync.htm- gagsbhHelpful | Level 5
Thanks! It worked.
About Dropbox tips & tricks
Learn how to get the most out of Dropbox with other users like you.405 PostsLatest Activity: 19 hours ago
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!