Skip to main content

download_progress

Function download_progress 

Source
pub fn download_progress(total_bytes: u64, verbosity: Verbosity) -> ProgressBar
Expand description

Create a progress bar for file downloads.

Shows bytes downloaded, download speed, and estimated time remaining.

§Arguments

  • total_bytes - Total size of download in bytes
  • verbosity - Verbosity level to respect

§Returns

A configured progress bar, or hidden bar if progress shouldn’t be shown.

§Examples

use oxigaf_cli::progress;
use oxigaf_cli::verbosity::Verbosity;

let pb = progress::download_progress(1024 * 1024 * 100, Verbosity::Normal);
// Update as bytes are received
pb.inc(4096);
pb.finish_with_message("Download complete");