Optionaloptions: FileLockOptionsAcquires the lock, waiting if necessary until it is available.
Optionalsignal: AbortSignal | nullAn optional AbortSignal to cancel the acquire operation.
A promise that resolves when the lock is acquired.
Attempts to acquire the lock without waiting.
True if the lock was successfully acquired, false otherwise.
Releases the lock.
A simple file-based lock mechanism.
Creates a
.lockfile 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: