Kfg Documentation
    Preparing search index...

    Function safeMutateFileSync

    • Transactional read-modify-write under a single lock acquisition, preventing lost updates when multiple processes mutate the same file. read returns the current content (or undefined), mutate produces the new content from it, and the result is written atomically — all while the lock is held.

      Parameters

      • filePath: string
      • read: () => string | undefined
      • mutate: (current: string | undefined) => string
      • options: SafeWriteOptions = {}

      Returns void