{"id":19261891,"url":"https://github.com/bzsome/chaogodown","last_synced_at":"2025-04-21T17:31:01.334Z","repository":{"id":144211854,"uuid":"265778196","full_name":"bzsome/ChaoGoDown","owner":"bzsome","description":"Go语言，多线程并发，分段下载，保存下载进度，中断继续下载","archived":false,"fork":false,"pushed_at":"2020-05-21T16:04:03.000Z","size":6394,"stargazers_count":13,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-01T14:46:09.955Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bzsome.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2020-05-21T07:00:07.000Z","updated_at":"2025-03-29T01:34:39.000Z","dependencies_parsed_at":null,"dependency_job_id":"42f8d54c-0903-408a-8be4-e824b28b18ff","html_url":"https://github.com/bzsome/ChaoGoDown","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bzsome%2FChaoGoDown","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bzsome%2FChaoGoDown/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bzsome%2FChaoGoDown/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bzsome%2FChaoGoDown/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bzsome","download_url":"https://codeload.github.com/bzsome/ChaoGoDown/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250100293,"owners_count":21374910,"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":[],"created_at":"2024-11-09T19:28:46.080Z","updated_at":"2025-04-21T17:31:01.328Z","avatar_url":"https://github.com/bzsome.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"## ChaoGoDown\n基于Go语言的多线程文件下载\n\n新增功能：通过配置文件的方式保存下载进度，程序中断重启能够继续下载\n新增功能：已打包成exe，可直接下载exe，在cmd环境下执行\n\n## 主要功能\n- [√] 多线程分段下载\n- [√] 自定义请求头\n- [√] 下载进度保存\n- [√] 指定线程数量\n- [√] 指定下载块大小\n- [√] 接收cmd命令\n    \n## 使用说明\n    1、如有片段提示下载失败，重新执行程序即可，直到没有任何错误提示\n    2、如需完全重新下载文件，请删除yaml配置文件。继续下载不用删除！\n    \n## 使用技巧\n    1、下载github文件。调小chunkSize，调大poolSize\n    2、github总是连接失败，由于github好像是随机服务器，有些服务器国内屏蔽了，重新执行程序即可\n    3、后面的片段下载很慢，正常的，毕竟线程数量变少了。可以尝试，减小chunkSize后下载剩余的片段\n    4、如果chunkSize设置过大，下载此片段的时间过长(或者中途响应超时)，导致片段下载失败\n    5、出现net/http: TLS handshake timeout，建议逐渐调小chunkSize。\n\n## CMD命令\n    示例(从github下载nacos)：\n    downCmd.exe -n 10 -c 10240 -url https://github.com/alibaba/nacos/releases/download/1.2.1/nacos-server-1.2.1.tar.gz\n    \n 相关参数\n \n      -c int\n            数据块大小，默认100K (default 102400)\n      -n int\n            并行数量,默认为50 (default 50)\n      -path string\n            保存路径 (default \"downloads\")\n      -url string\n            url地址, 必填\n            \n## 建议参数\n\n- PoolSize 线程池大小(最终速度：ChuckSize*poolSize = 1024K*1024M*poolSize)\n- ChuckSize 每个线程池下载块大小（github建议1024 * 4，国内建议1024*1024） \n\n## Example App\n    package main\n    \n    import (\n    \t\"fmt\"\n    \n    \t\"github.com/bzsome/ChaoGoDown/chaoDown\"\n    )\n    \n    func main() {\n    \trequest := \u0026chaoDown.Request{\n    \t\tMethod: \"get\",\n    \t\tURL:    \"https://github.com/alibaba/nacos/releases/download/1.2.1/nacos-server-1.2.1.tar.gz\",\n    \t\tHeader: map[string]string{\n    \t\t\t\"User-Agent\": \"Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36\",\n    \t\t},\n    \t}\n    \tdownload := \u0026chaoDown.Downloader{\n    \t\t//PoolSize:  100,\n    \t\t//ChuckSize: 1024 * 100,\n    \t\tPath: \"downloads\",\n    \t}\n    \n    \terr := download.Down(request)\n    \tif err != nil {\n    \t\tfmt.Println(err)\n    \t} else {\n    \t\ttime := download.GetExeTime()\n    \t\tfmt.Printf(\"下载用时：%.2f 秒，保存路径：%s\", time.Seconds(), download.GetSavePath())\n    \t}\n    \n    }\n\n\n## 项目结构\n```\nChaoGoDown\n│   README.md           说明文件\n│   go.mod              模块管理\n│   main.go             主模块，功能齐全，主要用户调试\n│   downCmd.go          接收CMD指令，可以打包成可执行文件\n│   example.go          简单的示例代码\n│\n└───chaoDown        主要的包\n│   │   downloader.go       下载器。用下载器来下载url，支持多线程、分段下载\n│   │   request.go          请求配置，包含请求url的信息\n│   \n└───utils           工具包\n    │   YamlConfig.go       Yaml配置，主要用于保存下载进度，中断继续下载\n    │   Clone.go            对象复制，主要用于默认参数的读取\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbzsome%2Fchaogodown","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbzsome%2Fchaogodown","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbzsome%2Fchaogodown/lists"}