
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
directory-hash-lock
Advanced tools
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:
npm install --save-dev directory-hash-lock
or
yarn add --dev directory-hash-lock
--pathSpecifies the absolute or relative path to the directory that you want to hash. If no path is provided, it defaults to ./patches.
Example usage:
npm run directory-hash-lock -- --path=/path/to/your/directory
--patternsSpecifies 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:
npm run directory-hash-lock -- --patterns="**/*.txt,**/*.json"
--frozen-lockfilePrevents 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:
npm 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:
npm 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:
FAQs
Generates lockfile for the given directory
The npm package directory-hash-lock receives a total of 4 weekly downloads. As such, directory-hash-lock popularity was classified as not popular.
We found that directory-hash-lock demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.