node: ^6.0.0
npm i tm-md5file
const fd5Class = require('./md5File');
// opt => it's non-essential
let opt = {
start: 0,
end: 65535
}
const fd5 = new fd5Class('../../filename.exe', opt);
fd5.on('progress', p => {
console.log(`current progress ${p}%`);
});
fd5.on('error', err => {
console.log(err);
});
fd.start();
//pause
setTimeout(() => {
fd.pause();
}, 2000);
//resume
setTimeout(() => {
fd.resume()
},3000);
//cancel
setTimeout(() => {
fd.cancel()
},4000)
current progress 0%
current progress 1%
current progress 2%
current progress 3%
current progress 4%
current progress 5%
current progress 6%
current progress 7%
current progress 8%
current progress 9%
current progress 10%
current progress 11%
current progress 12%
current progress 13%
current progress 14%
current progress 15%
current progress 16%
current progress 17%
current progress 18%
current progress 19%
current progress 20%
current progress 21%
current progress 22%
current progress 23%
current progress 24%
current progress 25%
current progress 26%
current progress 27%
current progress 28%
current progress 30%
current progress 31%
current progress 32%
current progress 33%
current progress 34%
current progress 35%
current progress 36%
current progress 37%
current progress 38%
current progress 39%
current progress 40%
current progress 41%
current progress 42%
current progress 43%
current progress 44%
current progress 45%
current progress 46%
current progress 47%
current progress 48%
current progress 49%
current progress 50%
current progress 51%
current progress 52%
current progress 53%
current progress 54%
current progress 55%
progress pause
progress resume
current progress 56%
current progress 57%
current progress 59%
current progress 60%
current progress 61%
current progress 62%
current progress 63%
current progress 64%
current progress 65%
current progress 66%
current progress 67%
current progress 68%
current progress 69%
current progress 70%
current progress 71%
current progress 72%
current progress 73%
current progress 74%
current progress 75%
current progress 76%
current progress 77%
current progress 78%
current progress 79%
current progress 80%
current progress 81%
progress stop