Kfg Documentation
    Preparing search index...

    Function withFileLock

    • Runs fn while holding the exclusive write lock for filePath, releasing it afterwards even on error. Use this to make a whole read-modify-write sequence atomic across processes (preventing lost updates), not just the final write.

      Type Parameters

      • T

      Parameters

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

      Returns T