How to create a partial download in twisted?

How do you create multiple HTTPDownloader instances with partial downloads asynchronously? and does it collect the file automatically after the download is complete?

+1
source share
1 answer

You should use the Range HTTP header:

Range Request only part of the object. Bytes are numbered from 0. Range: bytes = 500-999

Those. If you want to download 1000 files in 4 parts, you will start 4 downloads:

  • 0-2499
  • 2500-4999
  • 5000-7499
  • 7500-9999

And then just attach the data to the answers.

To check the file size, you can use the HEAD method:

HEAD Requests for an answer the same to that which would correspond to a GET, but without an answer, the body. This is useful for retrieving meta-information written in response headers, without the need to transport all content.

+2
source

Source: https://habr.com/ru/post/1401366/


All Articles