dandi.support.digests
¶
Provides helper to compute digests (md5 etc) on files
- class dandi.support.digests.Digester(digests: list[str] = <factory>, blocksize: int = 65536)[source]¶
Helper to compute multiple digests in one pass for a file
- blocksize: int = 65536¶
Chunk size (in bytes) by which to consume a file.
- digests: list[str]¶
List of any supported algorithm labels, such as md5, sha1, etc.
- dandi.support.digests.checksum_zarr_dir(files: dict[str, tuple[str, int]], directories: dict[str, tuple[str, int]]) str [source]¶
Calculate the Zarr checksum of a directory only from information about the files and subdirectories immediately within it.
- Parameters:
files – A mapping from names of files in the directory to pairs of their MD5 digests and sizes
directories – A mapping from names of subdirectories in the directory to pairs of their Zarr checksums and the sum of the sizes of all files recursively within them
- dandi.support.digests.get_zarr_checksum(path: Path, known: dict[str, str] | None = None) str [source]¶
Compute the Zarr checksum for a file or directory tree.
If the digests for any files in the Zarr are already known, they can be passed in the
known
argument, which must be adict
mapping slash-separated paths relative to the root of the Zarr to hex digests.