Skip to content

Commit

Permalink
Use human readable units when loading snapshots. (#1407)
Browse files Browse the repository at this point in the history
  • Loading branch information
lemmih authored Jan 31, 2022
1 parent a54b8d8 commit e854cea
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions utils/net_utils/src/download.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use async_std::fs::File;
use async_std::io::BufReader;
use futures::prelude::*;
use isahc::{Body, HttpClient};
use pbr::ProgressBar;
use pbr::{ProgressBar, Units};
use pin_project_lite::pin_project;
use std::convert::TryFrom;
use std::io::{self, Stdout, Write};
Expand Down Expand Up @@ -69,7 +69,8 @@ impl TryFrom<Url> for FetchProgress<Body, Stdout> {

let request = client.get(url.as_str())?;

let pb = ProgressBar::new(total_size);
let mut pb = ProgressBar::new(total_size);
pb.set_units(Units::Bytes);

Ok(FetchProgress {
progress_bar: pb,
Expand All @@ -84,7 +85,8 @@ impl TryFrom<File> for FetchProgress<BufReader<File>, Stdout> {
fn try_from(file: File) -> Result<Self, Self::Error> {
let total_size = async_std::task::block_on(file.metadata())?.len();

let pb = ProgressBar::new(total_size);
let mut pb = ProgressBar::new(total_size);
pb.set_units(Units::Bytes);

Ok(FetchProgress {
progress_bar: pb,
Expand Down

0 comments on commit e854cea

Please sign in to comment.