@karmaniverous/jeeves
    Preparing search index...

    Function atomicWrite

    • Write content to a file atomically via a temp file + rename.

      Parameters

      • filePath: string

        Absolute path to the target file.

      • content: string

        Content to write.

      • options: { mode?: number } = {}

        Optional file mode for the written file.

      Returns void

      Retries the rename up to three times on EPERM (Windows file-handle contention) with a 100 ms synchronous delay between attempts.

      When options.mode is given, the temp file gets exactly that mode before the rename (so a secret-bearing file is never visible with wider permissions); on Windows only the read-only bit is affected.