Function fetch_data::download
source · [−]pub fn download<AnyString0: AsRef<str>, AnyPath1: AsRef<Path>>(
url: AnyString0,
path: AnyPath1
) -> Result<(), FetchDataError>Expand description
Download a file from a URL.
Example
use fetch_data::download;
use temp_testdir::TempDir;
// Create a temporary local directory.
let temp_dir = TempDir::default();
// Download a file to the temporary directory.
let path = temp_dir.join("small.fam");
download(
"https://raw.githubusercontent.com/CarlKCarlK/fetch-data/main/tests/data/small.fam",
&path,
)?;
assert!(path.exists());