{"id":21658304,"url":"https://github.com/machinebox/progress","last_synced_at":"2025-12-25T05:47:10.221Z","repository":{"id":56496350,"uuid":"115859525","full_name":"machinebox/progress","owner":"machinebox","description":"io.Reader and io.Writer with progress and remaining time estimation","archived":false,"fork":false,"pushed_at":"2020-10-28T16:54:29.000Z","size":46,"stargazers_count":409,"open_issues_count":4,"forks_count":28,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-06-18T12:47:29.779Z","etag":null,"topics":["golang","io","machinebox"],"latest_commit_sha":null,"homepage":"https://blog.machinebox.io/measuring-the-progress-of-long-running-io-reader-and-io-writer-operations-in-go-ba26b204a507","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/machinebox.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":"2017-12-31T11:36:58.000Z","updated_at":"2024-03-14T14:31:33.000Z","dependencies_parsed_at":"2022-08-15T19:50:35.055Z","dependency_job_id":null,"html_url":"https://github.com/machinebox/progress","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/machinebox%2Fprogress","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/machinebox%2Fprogress/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/machinebox%2Fprogress/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/machinebox%2Fprogress/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/machinebox","download_url":"https://codeload.github.com/machinebox/progress/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226304557,"owners_count":17603618,"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":["golang","io","machinebox"],"created_at":"2024-11-25T09:29:03.408Z","updated_at":"2025-12-25T05:47:10.215Z","avatar_url":"https://github.com/machinebox.png","language":"Go","readme":"# `progress` [![GoDoc](https://godoc.org/github.com/machinebox/progress?status.png)](http://godoc.org/github.com/machinebox/progress) [![Build Status](https://travis-ci.org/machinebox/progress.svg?branch=master)](https://travis-ci.org/machinebox/progress) [![Go Report Card](https://goreportcard.com/badge/github.com/machinebox/progress)](https://goreportcard.com/report/github.com/machinebox/progress)\n\n`io.Reader` and `io.Writer` with progress and remaining time estimation.\n\n## Usage\n\n```go\nctx := context.Background()\n\n// get a reader and the total expected number of bytes\ns := `Now that's what I call progress`\nsize := len(s)\nr := progress.NewReader(strings.NewReader(s))\n\n// Start a goroutine printing progress\ngo func() {\n\tctx := context.Background()\n\tprogressChan := progress.NewTicker(ctx, r, size, 1*time.Second)\n\tfor p := range progressChan {\n\t\tfmt.Printf(\"\\r%v remaining...\", p.Remaining().Round(time.Second))\n\t}\n\tfmt.Println(\"\\rdownload is completed\")\n}()\n\n// use the Reader as normal\nif _, err := io.Copy(dest, r); err != nil {\n\tlog.Fatalln(err)\n}\n```\n\n1. Wrap an `io.Reader` or `io.Writer` with `NewReader` and `NewWriter` respectively\n1. Capture the total number of expected bytes\n1. Use `progress.NewTicker` to get a channel on which progress updates will be sent\n1. Start a Goroutine to periodically check the progress, and do something with it - like log it\n1. Use the readers and writers as normal\n","funding_links":[],"categories":["Go"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmachinebox%2Fprogress","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmachinebox%2Fprogress","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmachinebox%2Fprogress/lists"}