Hi, I am using the following code and noticed that my file is not always downloaded completely. It even optimised with a loop (found online) but this did not solve the problem, can you please help?
using var response = await DropboxClient.AsMember(memberId).Files.DownloadAsync(path).ConfigureAwait(false);
fileResponse.ContentType = "application/octet-stream";
using (var stream = await response.GetContentAsStreamAsync().ConfigureAwait(false))
{
var bufferSize = 4096;
var buffer = new byte[bufferSize];
var readCount = await stream.ReadAsync(buffer, 0, bufferSize).ConfigureAwait(false);
while (readCount > 0)
{
// File is a stream
await fileResponse.File.WriteAsync(buffer, 0, readCount).ConfigureAwait(false);
readCount = await stream.ReadAsync(buffer, 0, bufferSize).ConfigureAwait(false);
}
}