gix_features::hash

Function 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