{"id":23275508,"url":"https://github.com/yasnateam/hercules","last_synced_at":"2026-03-10T10:06:04.454Z","repository":{"id":82279813,"uuid":"180296962","full_name":"YasnaTeam/hercules","owner":"YasnaTeam","description":"Simple concurrent download library for GO","archived":false,"fork":false,"pushed_at":"2019-04-13T09:37:46.000Z","size":9,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-08T07:03:56.580Z","etag":null,"topics":["concurrency","downloader","golang","library"],"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/YasnaTeam.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-04-09T06:09:35.000Z","updated_at":"2021-01-07T15:58:57.000Z","dependencies_parsed_at":"2023-07-03T13:46:47.839Z","dependency_job_id":null,"html_url":"https://github.com/YasnaTeam/hercules","commit_stats":{"total_commits":3,"total_committers":1,"mean_commits":3.0,"dds":0.0,"last_synced_commit":"7f2abfdc16055a2cbfa09c63d3ada38cb992514e"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/YasnaTeam/hercules","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YasnaTeam%2Fhercules","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YasnaTeam%2Fhercules/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YasnaTeam%2Fhercules/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YasnaTeam%2Fhercules/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/YasnaTeam","download_url":"https://codeload.github.com/YasnaTeam/hercules/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YasnaTeam%2Fhercules/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271449270,"owners_count":24761644,"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","status":"online","status_checked_at":"2025-08-21T02:00:08.990Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["concurrency","downloader","golang","library"],"created_at":"2024-12-19T21:14:29.431Z","updated_at":"2026-03-10T10:05:59.420Z","avatar_url":"https://github.com/YasnaTeam.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Hercules :muscle: :trident:\n\nHercules is a concurrent download library for `GO` with a simple interface!\n\n## Usages :loudspeaker:\nImport it from `github.com/YasnaTeam/hercules` header, pass the file address, save path and the number of concurrent workers to the `Get` method and that's done!\n\n## Samples :art:\nThese codes are tested under this environment:\n```bash\nyasna@freedom:~/Go/src/github.com/meysampg/testDownloader \n$ go version                                   \ngo version go1.10.4 linux/amd64\n\nyasna@freedom:~/Go/src/github.com/meysampg/testDownloader \n$ uname -r\n4.15.0-46-generic\n```\n\n### :one: Simple Download :pizza:\n* :scroll: Code:\n```go\npackage main  \n  \nimport (  \n\t\"fmt\"\n\t\"github.com/YasnaTeam/hercules\"\n)  \n  \nfunc main() {  \n\telapsed, err := hercules.Get(  \n\t\t\"https://upload.wikimedia.org/wikipedia/commons/e/e6/Hazy_Crazy_Sunrise.jpg\",  \n\t\t\"/tmp/sunrise.jpg\",\n\t\t5,  \n\t)  \n\tif err != nil {  \n\t\tpanic(err)  \n\t}  \n  \n\tfmt.Printf(\"Total download time: %s\\n\", elapsed)  \n}\n```\n\n* :chart_with_upwards_trend: Run:\n```bash\nyasna@freedom:~/Go/src/github.com/meysampg/testDownloader \n$ go run main.go\nTotal download time: 54.55608664s\n\nyasna@freedom:~/Go/src/github.com/meysampg/testDownloader \n$ ll /tmp/sunrise.jpg\n-rw-r--r-- 1 yasna yasna 12M Apr 10 12:21 /tmp/sunrise.jpg\n\nyasna@freedom:~/Go/src/github.com/meysampg/testDownloader \n$ # due to the downloading time, it seems today the SSL handshakes has a serious problem, thanks to our big brother :/\n```\n\n### :two: Advanced usage of `hercules` methods :beers:\n* :scroll: Code:\n```go\npackage main  \n  \nimport (  \n\t\"fmt\"  \n\t\"os\"  \n\t\"github.com/YasnaTeam/hercules\" \n\t\"github.com/sirupsen/logrus\"\n)\n\nfunc main() {  \n\t// write only flag (os.O_WRONLY, or a flag with this privileges) is crucial on creating a file pointer\n\tfp, err := os.OpenFile(\"/tmp/sunrise.jpg\", os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0644)  \n\tif err != nil {  \n\t\tpanic(err)  \n\t}\n\tdefer fp.Close()  \n  \n\th, err := hercules.New(  \n\t      \"https://upload.wikimedia.org/wikipedia/commons/e/e6/Hazy_Crazy_Sunrise.jpg\",\n\t      fp,  \n\t      5,  \n\t)  \n\tif err != nil {  \n\t\tpanic(err)  \n\t}  \n  \n\t// set an external logger\n\tlog := logrus.New()  \n\tlog.Level = logrus.DebugLevel  \n\th.SetLogger(log)  \n  \n\t// fetch file size and ensure that the server supports multi-part downloading\n\tif err := h.Preload(); err != nil {  \n\t\tpanic(err)  \n\t}  \n  \n\th.StartAll()\n  \n\th.Wait()  \n\tfmt.Printf(\"Total download time: %s\\n\", h.Elapsed())\n}\n```\n* :chart_with_upwards_trend: Run:\n```bash\nyasna@freedom:~/Go/src/github.com/meysampg/testDownloader \n$ go run main.go\nINFO[0001] Total size of file is 11915661B              \nINFO[0001] A new worker started...                       \nINFO[0001] A new worker started...                       \nINFO[0001] A new worker started...                       \nINFO[0001] A new worker started...                       \nINFO[0001] A new worker started...                       \nINFO[0001] Wait for finishing download...               \nINFO[0001] Start downloading part #0...                 \nINFO[0001] Start downloading part #3...                 \nINFO[0001] Start downloading part #2...                 \nINFO[0001] Start downloading part #1...                 \nINFO[0001] Start downloading part #4...                 \nINFO[0001] Writing offset 0 to the disk...              \nINFO[0001] Writing offset 7149396 to the disk...        \nINFO[0001] Writing offset 2383132 to the disk...        \nINFO[0001] Writing offset 4766264 to the disk...        \nINFO[0002] Writing offset 9532528 to the disk...        \nINFO[0019] Part #4 is done (18.230438277s).             \nINFO[0019] End of downloading part #4 (18.23035141s)... \nINFO[0021] Part #0 is done (20.054390877s).             \nINFO[0021] End of downloading part #0 (20.05481599s)... \nINFO[0023] Part #3 is done (22.30961579s).              \nINFO[0023] End of downloading part #3 (22.309480659s)... \nINFO[0024] Part #1 is done (22.931328433s).             \nINFO[0024] End of downloading part #1 (22.931287887s)... \nINFO[0024] Part #2 is done (23.357667822s).             \nINFO[0024] End of downloading part #2 (23.357594625s)... \nTotal download time: 23.357789185s\n\nyasna@freedom:~/Go/src/github.com/meysampg/testDownloader \n$ ll /tmp/sunrise.jpg\n-rw-r--r-- 1 yasna yasna 12M Apr 10 12:23 /tmp/sunrise.jpg\n\nyasna@freedom:~/Go/src/github.com/meysampg/testDownloader \n$ # in life, there are wounds that slowly annihilate the soul in isolation and our big brother is just one of them (probability the biggest) X(\n``` \n\n\n## Get It! :tada:\nThe library can be fetched in the normal manner which you install other libraries with `github.com/YasnaTeam/hercules` :see_no_evil:.\n\n * `get`: `go get github.com/YasnaTeam/hercules`\n * `dep`: `dep ensure -add github.com/YasnaTeam/hercules`\n\n## ToDo :thought_balloon:\n * Make the error channel on `Get` method more usable (or even usable).\n * Add `context` support to the downloader\n * Make `logger` support more useful and flexible\n\n------------\nMade with :heart: in [YasnaTeam](https://yasna.team).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyasnateam%2Fhercules","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyasnateam%2Fhercules","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyasnateam%2Fhercules/lists"}