(path: Path)
| 203 | |
| 204 | |
| 205 | def describe_file(path: Path) -> Tuple[str, int]: |
| 206 | hasher = hashlib.sha256() |
| 207 | size = 0 |
| 208 | with path.open("rb") as fp: |
| 209 | for chunk in iter(lambda: fp.read(io.DEFAULT_BUFFER_SIZE), b""): |
| 210 | hasher.update(chunk) |
| 211 | size += len(chunk) |
| 212 | |
| 213 | return hasher.hexdigest(), size |
| 214 | |
| 215 | |
| 216 | @dataclass |