oshash_buf

Function oshash_buf 

Source
pub fn oshash_buf<T>(file: &mut T, len: u64) -> Result<String, HashError>
where T: Seek + Read,
Expand description

Hashes a Read + Seek input if you already have a file handle. If the file has an existing seek offset, then it will be reset back to that position when the function exits

§Errors

Will return HashError::FileTooSmall if the file is smaller than 128kb Will return any IoError surfaced from the filesystem

§Example

let mut file = std::fs::File::open("test-resources/testdata").unwrap();
let len = file.metadata().unwrap().len();
let result = oshash::oshash_buf(&mut file, len).unwrap();

assert_eq!(result, "40d354daf3acce9c");