Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
cross-process-lock
Advanced tools
Readme
Cross-process file locking solution with lock-queue
const { lock } = require('cross-process-lock');
const { writeFileSync } = require('fs');
// create a lock for the given file
const unlock = await lock('file.txt')
// do smth with the file here
writeFileSync('file.txt', 'some content', 'utf8');
// unlock file with the received function
return unlock();
lock(file[, options])
- creates a lock for the given file for the actual process
Arguments:
{string} file
- the path of the file needs to be locked{lockOptions} options
- the options to use to lock file, e.g timeoutsReturns: Promise<Function>
- resolved with unlock
function in case of successful lock; rejected in case of file couldn't be lock in the given timeout
unlock(file)
- deletes the lock for the given file for the actual process
Arguments:
{string} file
- the path of the file needs to be unlockedReturns: Promise
- resolved in case of successful unlock or rejected in case of any error
withLock(file[, options], callback)
- executes the callback with locking before and unlocking after the execution
Arguments:
{string} file
- path of the file needs to be locked{lockOptions} options
- the options to use to lock file, e.g timeouts{() => Promise<T>} callback
- the function to be executedReturns: Promise<T>
- resolved/rejected with the result of the callback
Option | Description | Default |
---|---|---|
lockTimeout {number} | timeout (ms) when locks automatically released | 20 minutes |
waitTimeout {number} | timeout (ms) until lock waits to lock a file | 10 seconds |
The package uses the debug NPM package with cross-process-lock:PID
name, where PID
is the process ID of the current process.
To enable debug logging, use for example the DEBUG=cross-process-lock:*
environment variable, but for more information, check the documentation of the debug package.
FAQs
Cross-process file locking solution with lock-queue
The npm package cross-process-lock receives a total of 5,533 weekly downloads. As such, cross-process-lock popularity was classified as popular.
We found that cross-process-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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.