torchoutil.pyoutil.hashlib module¶
- hash_file(
- fpath: str | Path | BufferedReader,
- hash_type: Literal['sha256', 'md5'] | Hasher = 'md5',
- chunk_size: int | None = 268435456,
Return the hash value for a file.
Based on https://github.com/pytorch/audio/blob/v0.13.0/torchaudio/datasets/utils.py#L110
- Args:
fpath: Path to existing file. hash_type: Hash name or custom Hasher algorithm. chunk_size: Max chunk size in bytes. defaults to 268435456 (256 MiB).
- Returns:
Hash value as string.