{"id":43676543,"url":"https://github.com/watermint/bwlimit","last_synced_at":"2026-02-05T01:09:32.886Z","repository":{"id":57504166,"uuid":"74764015","full_name":"watermint/bwlimit","owner":"watermint","description":"Go library for bandwidth limitor of multiple Reader/Writer","archived":false,"fork":false,"pushed_at":"2017-07-11T09:10:29.000Z","size":10,"stargazers_count":1,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-04-16T18:50:33.819Z","etag":null,"topics":["bandwidth","bwlimit","concurrency","go","golang","library","reader","writer"],"latest_commit_sha":null,"homepage":"","language":"Go","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/watermint.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}},"created_at":"2016-11-25T14:15:31.000Z","updated_at":"2023-10-18T09:49:16.000Z","dependencies_parsed_at":"2022-08-28T02:02:01.871Z","dependency_job_id":null,"html_url":"https://github.com/watermint/bwlimit","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/watermint/bwlimit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/watermint%2Fbwlimit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/watermint%2Fbwlimit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/watermint%2Fbwlimit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/watermint%2Fbwlimit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/watermint","download_url":"https://codeload.github.com/watermint/bwlimit/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/watermint%2Fbwlimit/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29105270,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-05T00:52:08.035Z","status":"ssl_error","status_checked_at":"2026-02-05T00:52:07.703Z","response_time":62,"last_error":"SSL_read: 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":["bandwidth","bwlimit","concurrency","go","golang","library","reader","writer"],"created_at":"2026-02-05T01:09:32.232Z","updated_at":"2026-02-05T01:09:32.879Z","avatar_url":"https://github.com/watermint.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# bwlimit\n\n[![Build Status](https://travis-ci.org/watermint/bwlimit.svg?branch=master)](https://travis-ci.org/watermint/bwlimit)\n[![Coverage Status](https://coveralls.io/repos/github/watermint/bwlimit/badge.svg?branch=master)](https://coveralls.io/github/watermint/bwlimit?branch=master)\n\nLimit IO bandwidth for multiple io.Reader/io.Writer.\n\n## Usage\n\n```go\n\nfunc main() {\n\t// Limit to 100k Bytes per second\n\tbwlimit := NewBwlimit(100 * 1024, false)\n\n\t// Create io.Reader wrapper\n\tf1, _ := os.Open(\"data1.dat\")\n\tfr1 := bwlimit.Reader(f1)\n\n\tf2, _ := os.Open(\"data2.dat\")\n\tfr2 := bwlimit.Reader(f2)\n\n\t// Read loop\n\tfor {\n\t\tbuf := make([]byte, 100)\n\t\tn, err1 := fr1.Read(buf)\n\t\tn, err2 := fr2.Read(buf)\n\n\t\t// ...\n\t}\n\n\t// Wait for all reader close or reach EOF\n\tbwlimit.Wait()\n}\n```\n\n## Internal\n\n`Bwlimit` limits bandwidth by adjusting window size for each `io.Reader` or `io.Writer`. `Bwlimit` runs goroutine which invoke adjustment every takt time. Takt time is 10ms by default.\nThis mean if you setup `Bwlimit` as 100Mbytes per sec. Wrapped `Reader`/`Writer` could transmit 1Mbytes per 10ms. If your network router etc don't have enough buffer for hundle these traffic, please consider more higher fequencey like below.\n\n```go\nbwlimit := NewBwlimit(100 * 1024, false)\nbwlimit.SetTaktPerSecond(1000)\n```\n\nIn current implementation, above 1000 takt per second will be adjusted into 1000.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwatermint%2Fbwlimit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwatermint%2Fbwlimit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwatermint%2Fbwlimit/lists"}