Function gix_features::hash::bytes_of_file
source · pub fn bytes_of_file(
path: &Path,
num_bytes_from_start: u64,
kind: Kind,
progress: &mut dyn Progress,
should_interrupt: &AtomicBool
) -> Result<ObjectId>
Available on crate feature
progress
and (crate features rustsha1
or fast-sha1
) only.Expand description
Compute the hash of kind
for the bytes in the file at path
, hashing only the first num_bytes_from_start
while initializing and calling progress
.
num_bytes_from_start
is useful to avoid reading trailing hashes, which are never part of the hash itself,
denoting the amount of bytes to hash starting from the beginning of the file.
§Note
- Only available with the
gix-object
feature enabled due to usage of thegix_hash::Kind
enum and thegix_hash::ObjectId
return value. - Interrupts are supported.