{"id":23408518,"url":"https://github.com/vearutop/httpzip","last_synced_at":"2025-08-01T02:09:06.386Z","repository":{"id":269069933,"uuid":"906311907","full_name":"vearutop/httpzip","owner":"vearutop","description":"Serve/download multiple files over HTTP as ZIP in Go","archived":false,"fork":false,"pushed_at":"2025-07-25T11:56:40.000Z","size":21,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-25T17:57:46.452Z","etag":null,"topics":["golang","http-server","zip"],"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/vearutop.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":"2024-12-20T16:05:34.000Z","updated_at":"2025-07-25T11:56:18.000Z","dependencies_parsed_at":null,"dependency_job_id":"88c57660-9d3e-402b-839b-30639fea5e1c","html_url":"https://github.com/vearutop/httpzip","commit_stats":null,"previous_names":["vearutop/httpzip"],"tags_count":3,"template":false,"template_full_name":"bool64/go-template","purl":"pkg:github/vearutop/httpzip","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vearutop%2Fhttpzip","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vearutop%2Fhttpzip/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vearutop%2Fhttpzip/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vearutop%2Fhttpzip/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vearutop","download_url":"https://codeload.github.com/vearutop/httpzip/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vearutop%2Fhttpzip/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267079422,"owners_count":24032432,"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-07-25T02:00:09.625Z","response_time":70,"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":["golang","http-server","zip"],"created_at":"2024-12-22T15:15:13.879Z","updated_at":"2025-08-01T02:09:06.346Z","avatar_url":"https://github.com/vearutop.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# httpzip\n\n[![Build Status](https://github.com/vearutop/httpzip/workflows/test-unit/badge.svg)](https://github.com/vearutop/httpzip/actions?query=branch%3Amaster+workflow%3Atest-unit)\n[![Coverage Status](https://codecov.io/gh/vearutop/httpzip/branch/master/graph/badge.svg)](https://codecov.io/gh/vearutop/httpzip)\n[![GoDevDoc](https://img.shields.io/badge/dev-doc-00ADD8?logo=go)](https://pkg.go.dev/github.com/vearutop/httpzip)\n[![Time Tracker](https://wakatime.com/badge/github/vearutop/httpzip.svg)](https://wakatime.com/badge/github/vearutop/httpzip)\n![Code lines](https://sloc.xyz/github/vearutop/httpzip/?category=code)\n![Comments](https://sloc.xyz/github/vearutop/httpzip/?category=comments)\n\nServe multiple files in uncompressed ZIP stream (no temporary archive file) with progress (`Content-Length` header) status.\n\n```go\nh := httpzip.NewHandler(\"archive\")\nh.OnError = func(err error) {\n    log.Println(err)\n}\n\nc := \"hello world\"\n\nfor i := 0; i \u003c 10; i++ {\n    if err := h.AddFile(httpzip.FileSource{\n        Path:     fmt.Sprintf(\"file_%d.txt\", i),\n        Modified: time.Now(),\n        Size:     int64(len(c)),\n        Data: func(w io.Writer) error {\n            _, err := w.Write([]byte(c)) // Mimicking actual file source.\n\n            return err\n        },\n    }); err != nil {\n        log.Println(err)\n    }\n}\n\nh.ServeHTTP(rw, nil)\n```\n\nExtract ZIP file directly (no temporary archive file) from a URL.\n\n```go\nresp, err := http.Get(\"https://www.example.com/archive.zip\")\nif err != nil {\n    log.Fatal(err)\n}\ndefer resp.Body.Close()\n\nzr := httpzip.NewStreamReader(resp.Body)\n\nfor {\n    e, err := zr.Next()\n    if err == io.EOF {\n        break\n    }\n\n    if err != nil {\n        log.Fatalf(\"failed to find next file in zip: %s\", err)\n    }\n\n    log.Println(\"file path:\", e.Name)\n\n    if !e.IsDir() {\n        rc, err := e.Open()\n        if err != nil {\n            log.Fatalf(\"unable to open zip file entry: %s\", err)\n        }\n\n        w, err := io.Copy(io.Discard, rc)\n        if err != nil {\n            log.Fatalf(\"unable to stream zip file: %s (%d)\", err, w)\n        }\n\n        log.Println(\"file length:\", w)\n\n        if err := rc.Close(); err != nil {\n            log.Fatalf(\"failed to close zip file entry: %s\", err)\n        }\n    }\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvearutop%2Fhttpzip","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvearutop%2Fhttpzip","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvearutop%2Fhttpzip/lists"}