{"id":24062136,"url":"https://github.com/andrvv/downbuff","last_synced_at":"2026-06-09T01:05:57.257Z","repository":{"id":250954661,"uuid":"833122957","full_name":"ANDRVV/downbuff","owner":"ANDRVV","description":"🔗An easy-use raw HTTP request library","archived":false,"fork":false,"pushed_at":"2025-01-05T15:59:41.000Z","size":33,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-26T15:44:50.024Z","etag":null,"topics":["go","golang","http","http-requests","https","library","requests"],"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/ANDRVV.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":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-24T11:56:20.000Z","updated_at":"2025-01-05T15:59:45.000Z","dependencies_parsed_at":"2025-02-26T15:40:57.650Z","dependency_job_id":"7c362592-651e-4d67-b685-712f28acc270","html_url":"https://github.com/ANDRVV/downbuff","commit_stats":null,"previous_names":["andrvv/downbuff"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/ANDRVV/downbuff","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ANDRVV%2Fdownbuff","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ANDRVV%2Fdownbuff/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ANDRVV%2Fdownbuff/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ANDRVV%2Fdownbuff/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ANDRVV","download_url":"https://codeload.github.com/ANDRVV/downbuff/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ANDRVV%2Fdownbuff/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34086686,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-08T02:00:07.615Z","response_time":111,"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":["go","golang","http","http-requests","https","library","requests"],"created_at":"2025-01-09T08:20:12.933Z","updated_at":"2026-06-09T01:05:57.242Z","avatar_url":"https://github.com/ANDRVV.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003edownbuff\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003eAn easy-use raw HTTP request library\u003c/p\u003e\n\n\u003cdiv align=\"center\"\u003e\n\n[![Go Report Card](https://goreportcard.com/badge/github.com/ANDRVV/downbuff)](https://goreportcard.com/report/github.com/ANDRVV/downbuff) [![Go](https://github.com/ANDRVV/downbuff/actions/workflows/go.yml/badge.svg)](https://github.com/ANDRVV/downbuff/actions/workflows/go.yml)\n\n\u003c/div\u003e\n\n## Request page example\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"time\"\n\t\"github.com/ANDRVV/downbuff\"\n)\n\nfunc main() {\n\theaders := downbuff.Header{\n\t\tUSER_AGENT:      \"downbuff/1.0\",\n\t\tACCEPT:          \"text/html\",\n\t\tACCEPT_LANGUAGE: \"en-US,en;q=0.8\",\n\t\tHOST:            \"google.com\",\n\t}\n\n\tbaseRequest := downbuff.BodyRequest{Path: \"/\", HttpVersion: \"1.1\", Header: headers}\n\n\tconn := downbuff.Link(\"https://google.com\", downbuff.SockConf{Buffer: 2048, Timeout: 3 * time.Second})\n    \tdefer conn.Quit()\n\n\tok, response1 := conn.Req(downbuff.METHOD_GET, baseRequest)\n\tif !ok {\n\t\tfmt.Println(\"error:\", conn.GetError().Error())\n\t}\n\tfmt.Println(response1.StatusCode == downbuff.CODE_200)\n\n\tbaseRequest.Path = \"/maps\"\n\tok, response2 := conn.Req(downbuff.METHOD_GET, baseRequest)\n\tif !ok {\n\t\tfmt.Println(\"error:\", conn.GetError().Error())\n\t}\n\tfmt.Println(response2.StatusCode == downbuff.CODE_200)\n\n\tfmt.Println(response1.HttpVersion, response1.StatusCode, response1.StatusText) // print HTTP version, status code, status text\n\tfmt.Println(response1.Summary())                                               // print serialized known headers + unknown headers\n\tfmt.Println(response1.Data)                                                    // print body of response\n\tfmt.Println(response1.Header.CONTENT_ENCODING)                                 // print stuff\n\n\t// ... same for response2\n}\n```\n\n## Download content example\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"github.com/ANDRVV/downbuff\"\n\t\"time\"\n)\n\nfunc main() {\n\theaders := downbuff.Header{\n\t\tRANGE: \"bytes=0-\", // Setting range, show content-length (good for performance in sync downloading)\n\t\tHOST:  \"esahubble.org\",\n\t}\n\n\tbaseRequest := downbuff.BodyRequest{Path: \"/media/archives/images/publicationtiff40k/heic1502a.tif\", HttpVersion: \"1.1\", Header: headers}\n\n\tconn := downbuff.Link(\"https://esahubble.org\", downbuff.SockConf{Buffer: 2048}) // remove timeout param for download big data\n\tdefer conn.Quit()\n\n\tconn.SetFile(\"spaceimage.tif\") // enable sync downloading with chan (ContentLength, ContentDownloaded)\n\n\tgo func() {\n\t\tvar contentLength int64\n\t\tvar startTime time.Time\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase cl := \u003c-conn.ContentLength:\n\t\t\t\tcontentLength = cl\n\t\t\t\tstartTime = time.Now()\n\t\t\tcase cd := \u003c-conn.ContentDownloaded:\n\t\t\t\tdownloadSpeed := float64(cd) / time.Since(startTime).Seconds() / 1e6\n\t\t\t\tremainingTime := time.Duration((((contentLength - cd) / 1e6) / int64(max(downloadSpeed, 1))) * int64(time.Second)).String()\n\n\t\t\t\tfmt.Printf(\"\\rDownload progress: %.2f GB / %.2f GB (%.2f MB/s): %s remaining time...\", float64(cd)/1e9, float64(contentLength)/1e9, downloadSpeed, remainingTime)\n\t\t\t\tif contentLength == cd {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}()\n\n\tok, response := conn.Req(downbuff.METHOD_GET, baseRequest)\n\tfmt.Println(response.StatusCode)\n\tif ok \u0026\u0026 response.StatusCode == downbuff.CODE_200 {\n\t\tfmt.Println(\"Downloaded successfully\")\n\t}\n}\n```\n\n## Build Auth and Post\n\n```go\npackage main\n\nimport (\n\t\"github.com/ANDRVV/downbuff\"\n)\n\nfunc main() {\n\t// How to use Auth builder\n\n\tcredBasic := downbuff.Basic{Username: \"user\", Password: \"passwd\"}\n\n\t// Algorithm param not needed but easily assignable (default is MD5)\n\tcredDigest := downbuff.Digest{\n\t\tMethod: downbuff.METHOD_GET, \n\t\tPath: \"/\", \n\t\tUsername: \"user\", \n\t\tPassword: \"passwd\",\n\t\tAlgorithm: downbuff.MD5,\n\t}\n\n\t_ = downbuff.Header{\n\t\t// Auth with \"Basic\"\n\t\tAUTHORIZATION: downbuff.BuildAuth(downbuff.BASIC, downbuff.AuthInfo{BasicScheme: credBasic}),\n\t}\n\n\t_ = downbuff.Header{\n\t\t// Auth with \"Digest\"\n\t\tAUTHORIZATION: downbuff.BuildAuth(downbuff.DIGEST, downbuff.AuthInfo{DigestScheme: credDigest}),\n\t}\n\n\t// How to build data for POST request\n\n\tbaseRequest := downbuff.BodyRequest{Path: \"/\", HttpVersion: \"1.1\", Header: downbuff.Header{HOST: \"example.com\"},\n\t\tData: downbuff.BuildPOST(map[string]string{\"key1\": \"value1\", \"key2\": \"value2\"}),\n\t}\n\n\tconn := downbuff.Link(\"https://example.com\", downbuff.SockConf{})\n\tdefer conn.Quit()\n\n\tconn.Req(downbuff.METHOD_POST, baseRequest)\n\t\n\t// some stuff here\n}\n```\n\n\u003e [!NOTE]\n\u003e To add multiple or unknown headers use `UnkHeader` from `downbuff.BodyRequest` with `map[string]string` syntax.\n\n\u003ch2 align=\"center\"\u003eCredits\u003c/h2\u003e\n\n\u003cp align=\"center\"\u003eAndrea Vaccaro\u003c/p\u003e\n\n\u003chr\u003e\n\n\u003cp\u003eDocs and update soon🚀\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrvv%2Fdownbuff","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandrvv%2Fdownbuff","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrvv%2Fdownbuff/lists"}