Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use human readable units when loading snapshots. #1407

Merged
merged 1 commit into from
Jan 31, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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