{"id":37121770,"url":"https://github.com/andrewarrow/pb","last_synced_at":"2026-01-14T14:01:05.357Z","repository":{"id":57541752,"uuid":"292039362","full_name":"andrewarrow/pb","owner":"andrewarrow","description":"Console progress bar for Golang","archived":false,"fork":true,"pushed_at":"2020-09-01T15:50:17.000Z","size":270,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-31T04:02:48.250Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"cheggaaa/pb","license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/andrewarrow.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-09-01T15:42:35.000Z","updated_at":"2020-09-01T15:50:07.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/andrewarrow/pb","commit_stats":null,"previous_names":[],"tags_count":45,"template":false,"template_full_name":null,"purl":"pkg:github/andrewarrow/pb","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewarrow%2Fpb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewarrow%2Fpb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewarrow%2Fpb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewarrow%2Fpb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andrewarrow","download_url":"https://codeload.github.com/andrewarrow/pb/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewarrow%2Fpb/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28422402,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T13:30:50.153Z","status":"ssl_error","status_checked_at":"2026-01-14T13:29:08.907Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2026-01-14T14:01:04.795Z","updated_at":"2026-01-14T14:01:05.346Z","avatar_url":"https://github.com/andrewarrow.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Terminal progress bar for Go  \n[![Coverage Status](https://coveralls.io/repos/github/cheggaaa/pb/badge.svg)](https://coveralls.io/github/cheggaaa/pb)\n\n## Installation\n\n```\ngo get github.com/cheggaaa/pb/v3\n```   \n\nDocumentation for v1 bar available [here](README_V1.md)\n\n## Quick start   \n\n```Go\npackage main\n\nimport (\n\t\"time\"\n\t\n\t\"github.com/cheggaaa/pb/v3\"\n)\n\nfunc main() {\n\tcount := 100000\n\t// create and start new bar\n\tbar := pb.StartNew(count)\n\t\n\t// start bar from 'default' template\n\t// bar := pb.Default.Start(count)\n\t\n\t// start bar from 'simple' template\n\t// bar := pb.Simple.Start(count)\n\t\n\t// start bar from 'full' template\n\t// bar := pb.Full.Start(count)\n\t\n\tfor i := 0; i \u003c count; i++ {\n\t\tbar.Increment()\n\t\ttime.Sleep(time.Millisecond)\n\t}\n\tbar.Finish()\n}\n\n```\n\nResult will be like this:\n\n```\n\u003e go run test.go\n37158 / 100000 [================\u003e_______________________________] 37.16% 1m11s\n```\n\n## Settings\n\n```Go  \n// create bar\nbar := pb.New(count)\n\n// refresh info every second (default 200ms)\nbar.SetRefreshRate(time.Second)\n\n// force set io.Writer, by default it's os.Stderr\nbar.SetWriter(os.Stdout)\n\n// bar will format numbers as bytes (B, KiB, MiB, etc)\nbar.Set(pb.Bytes, true)\n\n// bar use SI bytes prefix names (B, kB) instead of IEC (B, KiB)\nbar.Set(pb.SIBytesPrefix, true)\n\n// set custom bar template\nbar.SetTemplateString(myTemplate)\n\n// check for error after template set\nif err = bar.Err(); err != nil {\n    return\n}\n\n// start bar\nbar.Start()\n\n``` \n\n## Progress bar for IO Operations\n```go\npackage main\n\nimport (\n\t\"crypto/rand\"\n\t\"io\"\n\t\"io/ioutil\"\n\n\t\"github.com/cheggaaa/pb/v3\"\n)\n\nfunc main() {\n\n\tvar limit int64 = 1024 * 1024 * 500\n\t// we will copy 200 Mb from /dev/rand to /dev/null\n\treader := io.LimitReader(rand.Reader, limit)\n\twriter := ioutil.Discard\n\n\t// start new bar\n\tbar := pb.Full.Start64(limit)\n\t// create proxy reader\n\tbarReader := bar.NewProxyReader(reader)\n\t// copy from proxy reader\n\tio.Copy(writer, barReader)\n\t// finish bar\n\tbar.Finish()\n}\n\n```\n\n## Custom Progress Bar templates\n\nRendering based on builtin text/template package. You can use existing pb's elements or create you own.\n\nAll available elements are described in element.go file.  \n\n#### All in one example:\n```go\ntmpl := `{{ red \"With funcs:\" }} {{ bar . \"\u003c\" \"-\" (cycle . \"↖\" \"↗\" \"↘\" \"↙\" ) \".\" \"\u003e\"}} {{speed . | rndcolor }} {{percent .}} {{string . \"my_green_string\" | green}} {{string . \"my_blue_string\" | blue}}`\n// start bar based on our template\nbar := pb.ProgressBarTemplate(tmpl).Start64(limit)\n// set values for string elements\nbar.Set(\"my_green_string\", \"green\").\n\tSet(\"my_blue_string\", \"blue\")\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrewarrow%2Fpb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandrewarrow%2Fpb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrewarrow%2Fpb/lists"}