parq_tools.utils.file_utils.atomic_file_copy

parq_tools.utils.file_utils.atomic_file_copy(src, dst, chunk_size=1048576, hash_method='sha256', show_progress=False, force=False)[source]

Copy a file atomically from src to dst.

Parameters:
  • src (Path) – Path to the source file.

  • dst (Path) – Path to the destination file or directory.

  • chunk_size – Size of chunks to read/write.

  • hash_method (Union[str, Callable[[], Any]]) – One of ‘fast’, ‘sha256’, ‘xxhash’ or a provided hash function.

  • show_progress (bool) – Show progress bar if True.

  • force (bool) – If True, copy even if files match.

Return type:

Path

Returns:

Path to the copied file.