Socket
Socket
Sign inDemoInstall

md5-file

Package Overview
Dependencies
0
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.1 to 1.1.0

test.js

23

index.js

@@ -23,8 +23,27 @@ // The MIT License (MIT)

"use strict";
var crypto = require('crypto');
var fs = require('fs');
module.exports = function (filename) {
var crypto = require('crypto');
var fs = require('fs');
var sum = crypto.createHash('md5');
sum.update(fs.readFileSync(filename));
return sum.digest('hex');
}
// if `strict` then throw error otherwise pass error through
module.exports.async = function (filename, callback, strict) {
fs.readFile(filename, function (error, data) {
if (error) {
if (strict) {
throw error;
} else {
return callback(error);
}
} else {
var sum = crypto.createHash('md5');
sum.update(data);
return callback(sum.digest('hex'));
}
});
}
{
"name": "md5-file",
"main": "index.js",
"version": "1.0.1",
"files" : [
"index.js", "test.js"
],
"version": "1.1.0",
"description": "return an md5sum of a given file",

@@ -24,3 +27,6 @@ "keywords": [

"email": "roryrjb@gmail.com"
},
"scripts" : {
"test" : "node test"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc