@karmaniverous/jeeves
    Preparing search index...

    Function withFileLock

    • Execute a callback while holding a file lock.

      Parameters

      • filePath: string

        Absolute path to the file to lock.

      • fn: () => void | Promise<void>

        Async callback to execute while holding the lock.

      Returns Promise<void>

      Acquires a lock on the file, executes the callback, and releases the lock in a finally block. The lock uses a 2-minute stale threshold and retries up to 5 times.