Function download

Source
pub fn download<AnyString0, AnyPath1>(
    url: AnyString0,
    path: AnyPath1,
) -> Result<(), Box<FetchDataError>>
where AnyString0: AsRef<str>, AnyPath1: AsRef<Path>,
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());