Reputation: 3108
I'm running a rails application which serves zip files to android and ios devices. These zip files are stored in S3 and vary between 10MB and 50MB.
The challenge is, sometimes when the user downloads the zip file from Android, the download stops inbetween downloads. So, I need to check the checksum of the file.
Right now, I'm computing the check sum by
Digest::MD5.file(open "https://s3path").hexdigest
and adding it to my headers
headers['Content-MD5'] = checksum
But this isn't efficient as open downloads the file first and computes it. Is there a better solution for this?
Upvotes: 4
Views: 9876
Reputation: 3116
I don't think you can get it without downloading the file.
How to get the md5sum of a file on Amazon's S3
For your case, wouldn't checking the file size work?
Upvotes: 0