pub fn get_hash_folder<HashType, P>(
dir: P,
hash: &mut HashType,
num_threads: usize,
progress: impl Fn(ProgressInfo),
) -> Result<String, Error>
Expand description
Get hash from folder
This function gets all files from a folder recursively and gets their hash
§Example
use std::path::PathBuf;
use blake2::{Blake2s256, Digest};
use file_hashing::get_hash_folder;
let mut hash = Blake2s256::new();
let result = get_hash_folder(
&PathBuf::from("/home/gladi/Pictures"),
&mut hash,
12,
|_| {},
)
.unwrap();
assert_eq!(result.len(), 64); // Blake2s256 len == 64
§Error
- If the folder is empty, the IOErrorKind::InvalidInput error will be returned