Security News
New Proposed CISA Mandate Would Require Critical Infrastructure to Report Ransom Payments Within 24 Hours
CISA has proposed a set of new rules that would require critical infrastructure to report cyber incidents and ransom payments.
lockfile
Advanced tools
A very polite lock file utility, which endeavors to not litter, and to wait patiently for others.
Weekly downloads
Readme
A very polite lock file utility, which endeavors to not litter, and to wait patiently for others.
var lockFile = require('lockfile')
// opts is optional, and defaults to {}
lockFile.lock('some-file.lock', opts, function (er) {
// if the er happens, then it failed to acquire a lock.
// if there was not an error, then the file was created,
// and won't be deleted until we unlock it.
// do my stuff, free of interruptions
// then, some time later, do:
lockFile.unlock('some-file.lock', function (er) {
// er means that an error happened, and is probably bad.
})
})
Sync methods return the value/throw the error, others don't. Standard node fs stuff.
All known locks are removed when the process exits. Of course, it's possible for certain types of failures to cause this to fail, but a best effort is made to not be a litterbug.
Acquire a file lock on the specified path
Acquire a file lock on the specified path
Close and unlink the lockfile.
Close and unlink the lockfile.
Check if the lockfile is locked and not stale.
Callback is called with cb(error, isLocked)
.
Check if the lockfile is locked and not stale.
Returns boolean.
A number of milliseconds to wait for locks to expire before giving up.
Only used by lockFile.lock. Poll for opts.wait
ms. If the lock is
not cleared by the time the wait expires, then it returns with the
original error.
When using opts.wait
, this is the period in ms in which it polls to
check if the lock has expired. Defaults to 100
.
A number of milliseconds before locks are considered to have expired.
Used by lock and lockSync. Retry n
number of times before giving up.
Used by lock. Wait n
milliseconds before retrying.
FAQs
A very polite lock file utility, which endeavors to not litter, and to wait patiently for others.
The npm package lockfile receives a total of 1,023,757 weekly downloads. As such, lockfile popularity was classified as popular.
We found that lockfile demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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
CISA has proposed a set of new rules that would require critical infrastructure to report cyber incidents and ransom payments.
Security News
Redis is no longer OSS, breaking its explicit commitment to remain under the BSD 3-Clause License forever. This has angered contributors who are now working to fork the software.
Product
Socket AI now enables 'AI detected potential malware' alerts by default, ensuring users benefit from AI-powered state-of-the-art malware detection without needing to opt-in.