utils.py: Add save_file_atomic utility

This is a context manager that can be used to divert file writes into a temporary file, which is then renamed into place once writing is complete. It is primarily intended for use by source plugins which download files, so they can ensure that their downloads appear atomic and there is no risk of leaving half-downloaded files in the cache.

Edited by Sam Thursfield

Merge request reports

Loading