Function git_features::hash::bytes_of_file
source · 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-objectfeature enabled due to usage of thegit_hash::Kindenum and thegit_hash::ObjectIdreturn value. - Interrupts are supported.