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: 

Large File Download

Large File Download

gagsbh
Explorer | Level 3

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

 
 
1 Accepted Solution

Accepted Solutions

Re: Large File Download

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

View solution in original post

2 Replies 2

Re: Large File Download

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

View solution in original post

Re: Large File Download

gagsbh
Explorer | Level 3

Thanks! It worked.

 
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
    gagsbh Explorer | Level 3
  • User avatar
    Greg-DB Dropboxer
What do Dropbox user levels mean?
Need more support?