Kfg Documentation
    Preparing search index...

    Function withFileLockAsync

    • Runs fn while holding the exclusive write lock for filePath, releasing it afterwards even on error. Unlike the sync version, waiting for the lock yields to the event loop instead of blocking it.

      Type Parameters

      • T

      Parameters

      • filePath: string
      • fn: () => T | Promise<T>
      • options: { lockTimeout?: number } = {}

      Returns Promise<T>