EU Parliament Monitor - API Documentation - v0.8.2
    Preparing search index...

    Function atomicWrite

    • Write content to a file atomically.

      Writes to a uniquely-named temporary file in the same directory first, then renames it to the final path. The temp filename includes the PID and a random UUID so that concurrent callers targeting the same destination never collide on the intermediate file. If the rename fails the temp file is cleaned up in a finally block. On platforms where renameSync does not overwrite an existing destination (e.g. Windows), the error is caught and the target is removed before retrying the rename.

      Parameters

      • filepath: string

        Final output file path

      • content: string

        File content to write

      Returns void