{"id":13438627,"url":"https://github.com/a8m/pb","last_synced_at":"2025-05-14T21:06:02.832Z","repository":{"id":38272814,"uuid":"44270224","full_name":"a8m/pb","owner":"a8m","description":"Console progress bar for Rust","archived":false,"fork":false,"pushed_at":"2024-01-10T15:37:51.000Z","size":9323,"stargazers_count":589,"open_issues_count":24,"forks_count":60,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-05-10T11:52:03.088Z","etag":null,"topics":["pb","pbr","progress-bar","progressbar","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/a8m.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-10-14T19:08:31.000Z","updated_at":"2025-05-06T12:14:48.000Z","dependencies_parsed_at":"2024-06-18T16:05:04.134Z","dependency_job_id":"f7ad6798-dbc2-46a1-89e1-0b3cf05e01af","html_url":"https://github.com/a8m/pb","commit_stats":{"total_commits":182,"total_committers":30,"mean_commits":6.066666666666666,"dds":0.3351648351648352,"last_synced_commit":"87db6b8dbdcb9347ed945a1bbfb1d0f30b23ab18"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a8m%2Fpb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a8m%2Fpb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a8m%2Fpb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a8m%2Fpb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/a8m","download_url":"https://codeload.github.com/a8m/pb/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254227611,"owners_count":22035669,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["pb","pbr","progress-bar","progressbar","rust"],"created_at":"2024-07-31T03:01:06.967Z","updated_at":"2025-05-14T21:06:02.775Z","avatar_url":"https://github.com/a8m.png","language":"Rust","readme":"# Terminal progress bar for Rust\n\n[![Latest version](https://img.shields.io/crates/v/pbr.svg)](https://crates.io/crates/pbr)\n[![License](https://img.shields.io/crates/l/pbr.svg)](https://github.com/a8m/pb/blob/master/LICENSE.md)\n[![Docs](https://img.shields.io/badge/docs-reference-blue.svg)](https://a8m.github.io/pb/doc/pbr/index.html)\n[![Build Status](https://travis-ci.org/a8m/pb.svg?branch=master)](https://travis-ci.org/a8m/pb)\n[![Gitter](https://badges.gitter.im/a8m/pb.svg)](https://gitter.im/a8m/pb?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge)\n\nConsole progress bar for Rust Inspired from [pb](http://github.com/cheggaaa/pb), support and \ntested on MacOS, Linux and Windows\n\n![Screenshot](https://github.com/a8m/pb/blob/master/gif/rec_v3.gif)\n\n[Documentation](https://a8m.github.io/pb/doc/pbr/index.html)\n\n### Examples\n1. simple example\n\n```rust\nuse pbr::ProgressBar;\nuse std::thread;\n\nfn main() {\n    let count = 1000;\n    let mut pb = ProgressBar::new(count);\n    pb.format(\"╢▌▌░╟\");\n    for _ in 0..count {\n        pb.inc();\n        thread::sleep_ms(200);\n    }\n    pb.finish_print(\"done\");\n}\n```\n\n2. MultiBar example. see full example [here](https://github.com/a8m/pb/blob/master/examples/multi.rs)\n```rust\nuse std::thread;\nuse pbr::MultiBar;\nuse std::time::Duration;\n\nfn main() {\n    let mut mb = MultiBar::new();\n    let count = 100;\n    mb.println(\"Application header:\");\n\n    let mut p1 = mb.create_bar(count);\n    let _ = thread::spawn(move || {\n        for _ in 0..count {\n            p1.inc();\n            thread::sleep(Duration::from_millis(100));\n        }\n        // notify the multibar that this bar finished.\n        p1.finish();\n    });\n\n    mb.println(\"add a separator between the two bars\");\n\n    let mut p2 = mb.create_bar(count * 2);\n    let _ = thread::spawn(move || {\n        for _ in 0..count * 2 {\n            p2.inc();\n            thread::sleep(Duration::from_millis(100));\n        }\n        // notify the multibar that this bar finished.\n        p2.finish();\n    });\n\n    // start listen to all bars changes.\n    // this is a blocking operation, until all bars will finish.\n    // to ignore blocking, you can run it in a different thread.\n    mb.listen();\n}\n```\n\n3. Broadcast writing (simple file copying)\n\n```rust\n#![feature(io)]\nuse std::io::copy;\nuse std::io::prelude::*;\nuse std::fs::File;\nuse pbr::{ProgressBar, Units};\n\nfn main() {\n    let mut file = File::open(\"/usr/share/dict/words\").unwrap();\n    let n_bytes = file.metadata().unwrap().len() as usize;\n    let mut pb = ProgressBar::new(n_bytes);\n    pb.set_units(Units::Bytes);\n    let mut handle = File::create(\"copy-words\").unwrap().broadcast(\u0026mut pb);\n    copy(\u0026mut file, \u0026mut handle).unwrap();\n    pb.finish_print(\"done\");\n}\n```\n\n### License\nMIT\n\n","funding_links":[],"categories":["Libraries","Rust","库 Libraries","库"],"sub_categories":["Command-line","命令行 Command-line","命令行"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fa8m%2Fpb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fa8m%2Fpb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fa8m%2Fpb/lists"}