folder-hash
Advanced tools
Comparing version 4.1.0 to 4.1.1
13
index.js
@@ -45,2 +45,3 @@ const crypto = require('crypto'), | ||
queue: debug('fhash:queue'), | ||
glob: debug('fhash:glob'), | ||
}; | ||
@@ -328,6 +329,6 @@ | ||
// transform match globs to Regex | ||
options.files.exclude = reduceGlobPatterns(options.files.exclude); | ||
options.files.include = reduceGlobPatterns(options.files.include); | ||
options.folders.exclude = reduceGlobPatterns(options.folders.exclude); | ||
options.folders.include = reduceGlobPatterns(options.folders.include); | ||
options.files.exclude = reduceGlobPatterns(options.files.exclude, 'exclude files'); | ||
options.files.include = reduceGlobPatterns(options.files.include, 'include files'); | ||
options.folders.exclude = reduceGlobPatterns(options.folders.exclude, 'exclude folders'); | ||
options.folders.include = reduceGlobPatterns(options.folders.include, 'include folders'); | ||
@@ -403,4 +404,5 @@ return Promise.resolve(log.params({ basename, dir, options })); | ||
function reduceGlobPatterns(globs) { | ||
function reduceGlobPatterns(globs, name) { | ||
if (isFunction(globs)) { | ||
log.glob(`Using function to ${name}`); | ||
return globs; | ||
@@ -418,2 +420,3 @@ } else if (!globs || !Array.isArray(globs) || globs.length === 0) { | ||
); | ||
log.glob(`Reduced glob patterns to ${name}`, { from: globs, to: regex }); | ||
return param => regex.test(param); | ||
@@ -420,0 +423,0 @@ } |
{ | ||
"name": "folder-hash", | ||
"version": "4.1.0", | ||
"version": "4.1.1", | ||
"description": "Create a hash checksum over a folder and its content - its children and their content", | ||
@@ -39,3 +39,3 @@ "main": "index.js", | ||
"debug": "4.4.0", | ||
"minimatch": "10.0.1" | ||
"minimatch": "7.4.6" | ||
}, | ||
@@ -42,0 +42,0 @@ "devDependencies": { |
@@ -141,2 +141,3 @@ Create a hash checksum over a folder or a file. | ||
algo: 'sha1', // see crypto.getHashes() for options in your node.js REPL | ||
algoOptions: {}, // Allowed for some algorithms, see https://nodejs.org/api/crypto.html#cryptocreatehashalgorithm-options | ||
encoding: 'base64', // 'base64', 'base64url', 'hex' or 'binary' | ||
@@ -190,5 +191,18 @@ files: { | ||
</td> | ||
<td>checksum algorithm, see options in crypto.getHashes()</td> | ||
<td>checksum algorithm, see options in <a href="https://nodejs.org/api/crypto.html#cryptogethashes">crypto.getHashes()</a></td> | ||
</tr> | ||
<tr> | ||
<td>algoOptions</td> | ||
<td> | ||
<span>Object</span> | ||
</td> | ||
<td> | ||
<optional><br> | ||
</td> | ||
<td> | ||
{} | ||
</td> | ||
<td>checksum algorithm options, see <a href="https://nodejs.org/api/crypto.html#cryptocreatehashalgorithm-options">docs</a></td> | ||
</tr> | ||
<tr> | ||
<td>encoding</td> | ||
@@ -341,3 +355,3 @@ <td> | ||
Configure, how symbolic links should be hashed. | ||
Configure how symbolic links should be hashed. | ||
To understand how the options can be combined to create a specific behavior, look into [test/symbolic-links.js](https://github.com/marc136/node-folder-hash/blob/master/test/symbolic-links.js). | ||
@@ -519,3 +533,3 @@ | ||
// only supported in node v12.8 and higher | ||
const options = { algo: 'shake256', algoOptions:{ outputLength: 5 }, files: { exclude: ['.*'], matchBasename: true } }; | ||
const options = { algo: 'shake256', algoOptions: { outputLength: 5 }, files: { exclude: ['.*'], matchBasename: true } }; | ||
hashElement(__dirname, options, (error, hash) => { | ||
@@ -522,0 +536,0 @@ if (error) { |
33928
444
577
+ Addedminimatch@7.4.6(transitive)
- Removedminimatch@10.0.1(transitive)
Updatedminimatch@7.4.6