pyufunc.atomic_save_file#

pyufunc.atomic_save_file(path, data, *, text_mode=True, overwrite=True)#

Atomically write text or bytes to a file.

Parameters:
  • path – Destination file path.

  • data – Text or bytes to write.

  • text_mode – If True, open the temporary part file in text mode.

  • overwrite – If True, overwrite an existing destination.

Note

Example

>>> atomic_save_file("note.txt", "hello")
Returns:

The destination path.

Return type:

Path