I download very large (2–300GB) files from the internet. Files have digests, MD5, SHA256, ...
I use a Python script;
hd = requests.get('URL', stream=True)
out_file = open('Out.File', 'wb')
md5 = hashlib.md5()
for chunk in HD.iter_contents(chunk_size=256k):
out_file.write(chunk)
md5.update(chunk)
The downloading periodically crashes. In this situation I store part of file and continue downloading a later time. (Using {"Range": "bytes=XXX-'}
tag in the get
function.)
Can I save state of MD5 object and continue the computing when download is continued?