Function get_hash_folders

Source
pub fn get_hash_folders<HashType, P>(
    dirs: &Vec<P>,
    hash: &mut HashType,
    num_threads: usize,
    progress: impl Fn(ProgressInfo),
) -> Result<String, Error>
where HashType: DynDigest + Clone + Send, P: AsRef<Path> + Sync,
Expand description

Get hash from folders

This function gets all files from a folders recursively and gets their hash

§Example

use std::path::PathBuf;
use blake2::{Blake2s256, Digest};
use file_hashing::get_hash_folders;

let mut hash = Blake2s256::new();

let result = get_hash_folders(
    &vec![PathBuf::from("/home/gladi/Pictures"), PathBuf::from("/home/gladi/Hentai")],
    &mut hash,
    12,
    |_| {},
)
.unwrap();

assert_eq!(result.len(), 64); // Blake2s256 len == 64

§Error

  • If the folders is empty, the IOErrorKind::InvalidInput error will be returned