archivebox.misc.system

Module Contents

Functions

atomic_write

Safe atomic write to filesystem by writing to temp file + atomic rename

get_dir_size

get the total disk size of a given directory, optionally summing up recursively and limiting to a given filter list

API

archivebox.misc.system.atomic_write(path: pathlib.Path | str, contents: dict | str | bytes, overwrite: bool = True, config=None, **config_kwargs) None[source]

Safe atomic write to filesystem by writing to temp file + atomic rename

archivebox.misc.system.get_dir_size(path: str | pathlib.Path, recursive: bool = True, pattern: str | None = None) tuple[int, int, int][source]

get the total disk size of a given directory, optionally summing up recursively and limiting to a given filter list