New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

glob-hash

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

glob-hash - npm Package Compare versions

Comparing version 1.0.3 to 1.0.4

2

lib/glob-hash.js

@@ -54,3 +54,3 @@ 'use strict'

deferred.resolve(
hashFiles(files, options.algorithm)
hashFiles(files, options)
);

@@ -57,0 +57,0 @@ }

@@ -7,2 +7,3 @@ 'use strict'

var q = require('q');
var path = require('path');

@@ -16,5 +17,5 @@ /**

*/
module.exports = function(files, algorithm) {
module.exports = function(files, options) {
var deferred = q.defer();
var hash = crypto.createHash(algorithm);
var hash = crypto.createHash(options.algorithm);
var funcs = files.map(function(file) {

@@ -26,2 +27,9 @@ return function(callback) {

} else {
if (options.filenames) {
if (options.jail) {
options.jail = path.resolve(options.jail);
file = file.substr(options.jail.length + 1);
}
hash.update(file.replace(/\\/g,'/'));
}
hash.update(data);

@@ -28,0 +36,0 @@ callback();

{
"name": "glob-hash",
"version": "1.0.3",
"version": "1.0.4",
"description": "npm module to hash the contents of files matched by globs",

@@ -5,0 +5,0 @@ "main": "lib/glob-hash.js",

@@ -30,2 +30,3 @@ # glob-hash

-j, --jail [path] A jail path. Reading outside the jail path will throw an error.
-n, --filenames Include filenames in the hash.

@@ -63,2 +64,4 @@ # Via API

*Boolean* **filenames** - Include filename in the file hash. If used in combination with jail path, filename includes relative path from jail, otherwise it includes full path.
### More samples

@@ -65,0 +68,0 @@ ```js

@@ -61,2 +61,10 @@ 'use strict'

}
}, {
name: 'Should hash text files including filenames with jail path',
result: '2aaea5813468828d7bb64d9c9a83f4ec4fae6cabccba6c733201fd2fa6e85b25',
options: {
include: ['**/*.tst'],
filenames: true,
jail: '.'
}
}];

@@ -63,0 +71,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc