torchcell.data.write_verified

write_verified(data: bytes, dest: str | Path, expected: str, source: str) → None[source]

Write data to dest only if it hashes to expected.

The digest is checked before anything is written; the bytes go to a sibling .partial file that is renamed into place, so dest never holds a partial or unverified payload. source names the origin (a URL) in the error.