pub fn bytes_of_file(
path: impl AsRef<Path>,
num_bytes_from_start: usize,
kind: Kind,
progress: &mut impl 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
git-object
feature enabled due to usage of thegit_hash::Kind
enum and thegit_hash::ObjectId
return value. - Interrupts are supported.