js-file-md5
v0.0.3
Published
Get a MD5 hash from a file with Javascript
Downloads
20
Readme
js-file-md5
Get a MD5 hash from a file with Javascript.
Usage
HTML
<input id="example-file" type="file" />
Javascript
import md5 from 'js-file-md5';
const fileInput = document.querySelector('#example-file');
fileInput.addEventListener('change', function(e) {
const file = e.target.files[0];
md5(file).then(hash => {
console.log(hash); // md5 hash
console.log(btoa(hash)); // base64 encode
}).catch(error => {
throw error;
});
});