Package safefile implements safe atomic saving of files by writing to a temporary file and renaming on commit.