.NET Dropbox API 以块的形式下载大文件



我需要从Dropbox下载大小超过100GB的大文件。我正在使用Dropbox .NET API。

为了在块中做到这一点,我调用GetContentAsStream方法如下:

var response = await client.Files.DownloadAsync(filePath);
using (var stream = await response.GetContentAsStreamAsync())
{
    var length = await stream.ReadAsync(buffer, 0, bufferSize, token);
    // Append to local file.
}

大约 5GB 后,我收到错误:Unable to read data from the transport connection: The connection was closed.

有没有明确的方法来下载指定偏移量和字节数的 Dropbox 文件块?这样,我将能够重试或从我需要的位置继续。

API v2/2/files/download HTTPS 端点本身确实支持"范围检索请求",但遗憾的是,目前尚未在 Dropbox .NET SDK 中实现。我会将其作为功能请求发送,但我不能保证是否/何时会在那里实现。

在这种情况下,您可以在 SDK 外部直接实现 HTTPS 调用,以便设置所需的 Range 标头。

最新更新