Skip to content

Instantly share code, notes, and snippets.

View alvr's full-sized avatar

Álvaro Salcedo García alvr

View GitHub Profile
@Roshan-R
Roshan-R / download.rs
Created April 3, 2023 19:48
Download file using ureq with progress bar
use indicatif::{ProgressBar, ProgressStyle};
use std::fs::File;
use std::io;
const DOWNLOAD_TEMPLATE: &str =
"{msg} {spinner:.green} [{elapsed_precise}] [{wide_bar:.cyan/blue}] {bytes}/{total_bytes} ({eta})";
pub fn download_file(url: &str) -> io::Result<()> {
let resp = ureq::get(&url).call().unwrap();