func WriteFileAtomic(filename string, data []byte, perm os.FileMode) (err error)
WriteFileAtomic creates a temporary file with data and provided perm and swaps it atomically with filename if successful.