Gathering detailed insights and metrics for directory-hash-lock
Gathering detailed insights and metrics for directory-hash-lock
Gathering detailed insights and metrics for directory-hash-lock
Gathering detailed insights and metrics for directory-hash-lock
npm package for generating a hash of a directory's contents and creating a lock file with that hash.
npm install directory-hash-lock
Typescript
Module System
Node Version
NPM Version
66.4
Supply Chain
97.2
Quality
75.6
Maintenance
100
Vulnerability
100
License
TypeScript (94.38%)
JavaScript (5.62%)
Total Downloads
5,623
Last Day
2
Last Week
2
Last Month
16
Last Year
267
21 Commits
1 Watching
1 Branches
1 Contributors
Minified
Minified + Gzipped
Latest Version
0.2.0
Package Id
directory-hash-lock@0.2.0
Unpacked Size
12.86 kB
Size
4.60 kB
File Count
8
NPM Version
9.6.6
Node Version
19.8.1
Publised On
31 May 2023
Cumulative downloads
Total Downloads
Last day
100%
2
Compared to previous day
Last week
0%
2
Compared to previous week
Last month
-20%
16
Compared to previous month
Last year
-95%
267
Compared to previous year
1
5
directory-hash-lock
is a lightweight and easy-to-use npm package for generating a hash of a directory's contents and creating a lock file with that hash. It's useful for detecting changes in the contents of a directory, such as verifying the integrity of files or tracking changes in version control systems.
crypto
module../patches
and **/*
respectively.Install the package using npm or yarn as a dev dependency:
1npm install --save-dev directory-hash-lock
or
1yarn add --dev directory-hash-lock
--path
Specifies the absolute or relative path to the directory that you want to hash. If no path is provided, it defaults to ./patches
.
Example usage:
1npm run directory-hash-lock -- --path=/path/to/your/directory
--patterns
Specifies the wildcard patterns to match the files to be included in the hash. Multiple patterns should be comma-separated. If no patterns are provided, it defaults to include all files (**/*
).
Example usage:
1npm run directory-hash-lock -- --patterns="**/*.txt,**/*.json"
--frozen-lockfile
Prevents the tool from overwriting an existing lock file if its hash differs from the current directory hash. This can be useful if you want to ensure that the contents of the directory haven't changed.
Example usage:
1npm run directory-hash-lock -- --frozen-lockfile
All options can be combined as needed. For instance, to hash a specific directory and only include .txt
files, without overwriting an existing lock file, you could run:
1npm run directory-hash-lock -- --path=/path/to/your/directory --patterns="**/*.txt" --frozen-lockfile
Generates a hash of the files in a directory and its subdirectories.
directoryPath
: The absolute or relative path to the directory.algo
: The algorithm to be used for hashing. Defaults to 'sha256'. Other values can be any algorithm supported by Node.js crypto
module.patterns
: An array of wildcard patterns to match the files to be included in the hash. Defaults to all files (['**/*']
).Returns a Promise that resolves with a string representing the hexadecimal hash of the directory's contents.
Generates a hash of a directory's contents and writes it to a lock file. If the frozenLockfile
parameter is set to true
, it will not overwrite the existing lock file if its hash differs from the current directory hash.
directoryPath
: The absolute or relative path to the directory.lockFilePath
: The absolute or relative path to the lock file. The lock file will be created if it does not exist.patterns
: An array of wildcard patterns to match the files to be included in the hash. Defaults to all files (['**/*']
).frozenLockfile
: A boolean indicating whether the lock file should be overwritten if the hash differs. Defaults to false
.Returns a Promise that resolves when the lock file has been written.
For more information, examples, and to contribute to the directory-hash-lock
package, please visit the GitHub repository:
No vulnerabilities found.
No security vulnerabilities found.