Skip to content
This repository has been archived by the owner on Jul 24, 2019. It is now read-only.

Commit

Permalink
Improve MD5 calculation. Fixes #462
Browse files Browse the repository at this point in the history
  • Loading branch information
connesc committed Feb 22, 2016
1 parent 012a276 commit 79b4d43
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions install.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ var progress = require('progress')
var AdmZip = require('adm-zip')
var cp = require('child_process')
var fs = require('fs-extra')
var hasha = require('hasha')
var helper = require('./lib/phantomjs')
var kew = require('kew')
var md5 = require('md5')
var path = require('path')
var request = require('request')
var url = require('url')
Expand Down Expand Up @@ -475,8 +475,8 @@ function downloadPhantomjs() {
* @return {Promise.<boolean>}
*/
function verifyChecksum(fileName, checksum) {
return kew.nfcall(fs.readFile, fileName).then(function (buffer) {
var result = checksum == md5(buffer)
return kew.resolve(hasha.fromFile(fileName, {algorithm: 'md5'})).then(function (hash) {
var result = checksum == hash
if (result) {
console.log('Verified checksum of previously downloaded file')
} else {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
"dependencies": {
"adm-zip": "~0.4.7",
"fs-extra": "~0.26.4",
"hasha": "^2.2.0",
"kew": "~0.7.0",
"md5": "~2.0.0",
"progress": "~1.1.8",
"request": "~2.67.0",
"request-progress": "~2.0.1",
Expand Down

0 comments on commit 79b4d43

Please sign in to comment.