confetti-box/src/utils.rs
G2 e78c61b410
Chunked uploads (#2)
* Switch database to begin using CBOR, and begin work on chunked uploads

* Chunked uploads work, no feedback to client yet

* Added poorly implemented progress for chunked uploads

* I think these methods are cursed

* Improved performance by properly limiting the number of uploads

* Properly show errors in file bars again

* Improved setup for chunk downloading, added chunk size to config

* Ran clippy, added chunk cleaner

* Ran `cargo fmt`
2024-11-03 05:47:26 -06:00

10 lines
305 B
Rust

use blake3::Hash;
use std::path::Path;
/// Get the Blake3 hash of a file, without reading it all into memory
pub async fn hash_file<P: AsRef<Path>>(input: &P) -> Result<Hash, std::io::Error> {
let mut hasher = blake3::Hasher::new();
hasher.update_mmap_rayon(input)?;
Ok(hasher.finalize())
}