Switch branches/tags
Nothing to show
Clone or download
Latest commit ffbfff6 Mar 6, 2016
Permalink
Failed to load latest commit information.
dist md5 file can work Mar 4, 2016
src md5 file can work Mar 4, 2016
.esformatter add dotfile Mar 2, 2016
.eslintrc add dotfile Mar 2, 2016
.gitignore add dotfile Mar 2, 2016
.jscsrc add dotfile Mar 2, 2016
.travis.yml add dotfile Mar 2, 2016
LICENSE Initial commit Mar 2, 2016
README.md Update README.md Mar 6, 2016
bower.json update bower.json Mar 4, 2016
gulpfile.js init Mar 2, 2016
index.js update index.js Mar 4, 2016
package.json update package.json Mar 4, 2016

README.md

browser-md5-file Build Status NPM Version

MD5 file in browser. Base on js-spark-md5.

Demo

demo

Installation

bower

$ bower install browser-md5-file --save

npm

$ npm install browser-md5-file --save

Usage

Use as global variable

<script src="bower_components/browser-md5-file/dist/browser-md5-file.js"></script>
var el = document.getElementById('upload');
el.addEventListener('change', handle, false);

function handle(e) {
  var file = e.target.files[0];
  browserMD5File(file, function (err, md5) {
    console.log(md5); // 97027eb624f85892c69c4bcec8ab0f11
  });
}

Use with npm

var browserMD5File = require('browser-md5-file');
var el = document.getElementById('upload');

el.addEventListener('change', handle, false);

function handle(e) {
  var file = e.target.files[0];
  browserMD5File(file, function (err, md5) {
    console.log(md5); // 97027eb624f85892c69c4bcec8ab0f11
  });
}

Use with jQuery

$('#upload').bind('change', function () {
  var file = e.target.files[0];
  browserMD5File(file, function (err, md5) {
    console.log(md5); // 97027eb624f85892c69c4bcec8ab0f11
  });
});

Browser compatibility

  • IE9+
  • Firefox
  • Chrome
  • Safari
  • Opera

License

MIT