satazor / js-spark-md5

Lightning fast normal and incremental md5 for javascript
Do What The F*ck You Want To Public License
2.46k stars 470 forks source link

Simplify calculating hash from file with chunked-file-reader #49

Open janko opened 6 years ago

janko commented 6 years ago

The chunked-file-reader comes with the functionality of reading a file in chunks, so we can simplify the file example a lot by offloading this logic to that package. I think this will make it much more approachable for people wanting to reuse that code.

The chunked-file-reader package uses readAsArrayBuffer(), and we cannot use it for tests that use readAsBinaryString().

Also, chunked-file-reader always uses File.prototype.slice, but I think that's ok now, since blob.mozSlice() is only needed for Firefox 12 and earlier, though I don't on which version did Safari start supporting File.prototype.slice (I tested that it works on Safari 11 which is the current latest version).

Closes https://github.com/satazor/js-spark-md5/issues/48