pub fn download<S: AsRef<str>, P: AsRef<Path>>(
    url: S,
    path: P
) -> 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());