pub fn hash_download<AnyString0, AnyPath1>(
url: AnyString0,
path: AnyPath1,
) -> Result<String, Box<FetchDataError>>
Expand description
Download a file from a URL and compute its hash.
ยงExample
use fetch_data::hash_download;
use temp_testdir::TempDir;
// Create a temporary local directory.
let temp_dir = TempDir::default();
let path = temp_dir.join("small.fam");
// Download a file and compute its hash.
let hash = hash_download(
"https://raw.githubusercontent.com/CarlKCarlK/fetch-data/main/tests/data/small.fam",
&path,
)?;
assert!(hash.eq("36e0086c0353ff336d0533330dbacb12c75e37dc3cba174313635b98dfe86ed2"));