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.
source share