如何创建多个异步部分下载的 HTTPDownloader 实例?所有下载完成后它会自动组装文件吗?
最佳答案
您必须使用 Range HTTP header :
Range. Request only part of an entity. Bytes are numbered from 0. Range: bytes=500-999
即。如果您想分 4 部分下载 1000 个文件,您将开始 4 次下载:
- 0-2499
- 2500-4999
- 5000-7499
- 7500-9999
然后只需连接响应中的数据即可。
要检查文件大小,您可以使用 HEAD 方法:
HEAD Asks for the response identical to the one that would correspond to a GET request, but without the response body. This is useful for retrieving meta-information written in response headers, without having to transport the entire content.
关于python - 如何在twisted中创建部分下载?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3328059/