Optional
options: LockFileOptionsAcquires the lock, waiting if necessary until it is available.
Optional
signal: null | AbortSignalAn optional AbortSignal to cancel the acquire operation.
A promise that resolves to a function that releases the lock.
Releases the lock.
Acquires the lock, executes the callback, and releases the lock.
Optional
signal: null | AbortSignalAn optional AbortSignal to cancel the acquire operation.
The result of the callback.
A simple file-based lock mechanism.
Creates a
.lock
file to indicate that a resource is locked. The lock is acquired by creating the lock file and released by deleting it. If the lock file already exists, it means the resource is locked by another process.Example usage: