pub fn download(url: &Url, file_name: &str) -> Result<(), CliError> {
    let client = Client::new();
    let res = client
        .get(url.clone())
        .send()
        .map_err(|err| CliError::InternalError(err.to_string()))?;
    if res.status().is_server_error() {
        return Err(CliError::ActionError(format!(
            "During {scheme} GET request to {url}: received server error {status:?}",
            scheme = url.scheme(),
            status = res.status()
        )));
    }
    let body = res
        .bytes()
        .map_err(|err| CliError::InternalError(err.to_string()))?;
    let mut file =
        File::create(file_name).map_err(|err| CliError::InternalError(err.to_string()))?;
    let mut cursor = Cursor::new(body);
    io::copy(&mut cursor, &mut file).map_err(|err| CliError::InternalError(err.to_string()))?;

    Ok(())
}
/// Uses the Reqwest library to download a file
///
/// * `url` - The URL of the file to download
/// * `file_name` - The resulting file path
Uses the Reqwest library to download a file
`url` - The URL of the file to download
`file_name` - The resulting file path
Uses the Reqwest library to download a file ` url ` - The URL of the file to download ` file_name ` - The resulting file path
pub fn download(url: &Url, file_name: &str) -> Result<(), CliError> {
    let client = Client::new();
    let res = client
        .get(url.clone())
        .send()
        .map_err(|err| CliError::InternalError(err.to_string()))?;
    if res.status().is_server_error() {
        return Err(CliError::ActionError(format!(
            "During {scheme} GET request to {url}: received server error {status:?}",
            scheme = url.scheme(),
            status = res.status()
        )));
    }
    let body = res
        .bytes()
        .map_err(|err| CliError::InternalError(err.to_string()))?;
    let mut file =
        File::create(file_name).map_err(|err| CliError::InternalError(err.to_string()))?;
    let mut cursor = Cursor::new(body);
    io::copy(&mut cursor, &mut file).map_err(|err| CliError::InternalError(err.to_string()))?;
    Ok(())
}
pub fn download ( url : & Url , file_name : & str ) -> Result < ( ) , CliError > { let client = Client :: new ( ) ; let res = client . get ( url . clone ( ) ) . send ( ) . map_err ( | err | CliError :: InternalError ( err . to_string ( ) ) ) ? ; if res . status ( ) . is_server_error ( ) { return Err ( CliError :: ActionError ( format ! ( " " scheme url scheme ( ) status res status ( ) ) ) ) ; } let body = res . bytes ( ) . map_err ( | err | CliError :: InternalError ( err . to_string ( ) ) ) ? ; let mut file = File :: create ( file_name ) . map_err ( | err | CliError :: InternalError ( err . to_string ( ) ) ) ? ; let mut cursor = Cursor :: new ( body ) ; io :: copy ( & mut cursor , & mut file ) . map_err ( | err | CliError :: InternalError ( err . to_string ( ) ) ) ? ; Ok ( ( ) ) }
Uses the Reqwest library to download a file
 `url` - The URL of the file to download
 `file_name` - The resulting file path
Uses the Reqwest library to download a file ` url ` - The URL of the file to download ` file_name ` - The resulting file path
url
&Url
file_name
&str