Hello,
I wrote a quick console app using Dropbox.NET with the intent of downloading particular files or folders from Dropbox (for archival purposes, etc...there are multiple reasons).
However, I quickly ran into an issue when it tried to download a 1GB file. I receive an OutOfMemoryException. Here is the code that I use:
---------------
private async Task DownloadFile(string dropboxPath, string targetPath) {
using (var response = await _dbx.Files.DownloadAsync(dropboxPath)) {
using (var source = await response.GetContentAsStreamAsync()) {
using (var target = File.Create(targetPath)) {
await source.CopyToAsync(target);
}
}
}
}
---------------
This code does work for smaller files, and I know my system itself is not out of memory (have over 8 GB still available). Am I doing something wrong?
Please advise...thanks!
Ryan