{"id":15566868,"url":"https://github.com/dipakpatil804/zipstream","last_synced_at":"2025-03-29T05:15:40.157Z","repository":{"id":37924747,"uuid":"503303012","full_name":"dipakpatil804/zipstream","owner":"dipakpatil804","description":"Reader which provides a decompressed stream of ZIP file. It provides the io.Reader interface.  ","archived":false,"fork":false,"pushed_at":"2022-06-14T13:02:12.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-03T14:50:14.038Z","etag":null,"topics":["go","golang","zip","zipreader","zipstream","zipstream-go"],"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/dipakpatil804.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}},"created_at":"2022-06-14T10:00:36.000Z","updated_at":"2022-06-22T11:13:19.000Z","dependencies_parsed_at":"2022-09-26T21:20:51.200Z","dependency_job_id":null,"html_url":"https://github.com/dipakpatil804/zipstream","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/dipakpatil804%2Fzipstream","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dipakpatil804%2Fzipstream/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dipakpatil804%2Fzipstream/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dipakpatil804%2Fzipstream/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dipakpatil804","download_url":"https://codeload.github.com/dipakpatil804/zipstream/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246140591,"owners_count":20729802,"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":["go","golang","zip","zipreader","zipstream","zipstream-go"],"created_at":"2024-10-02T17:07:52.110Z","updated_at":"2025-03-29T05:15:40.136Z","avatar_url":"https://github.com/dipakpatil804.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"## About this project\n\nThis project is a ZIP file reader which gives a decompressed stream of ZIP.\nThis project is implemented with the ZIP format specification given in below wiki page.\nhttps://en.wikipedia.org/wiki/ZIP_(file_format)\n\n## Types\n```\ntype ZipStream struct {\n    Reader   io.Reader\n}\n```\n**ZipStream** accepts an io.Reader to ZIP file as input.\n\n## Functions\n```\nfunc Next() (*LocalFileHeader, io.Reader, error)\n```\nNext() function will return the LocalFileHeader object which has file name and other details.\nIt also returns the io.Reader to the next file to read. Function will return io.EOF when there \nare no more files in ZIP.\n\n**Note: If you don't want to read current file, then you need to discard the content of current file.** \n\n**io.Copy(ioutil.Discard, reader)**\n\n```\nfunc Read(p []byte) (n int, err error)\n```\nRead function should only be called on the io.Reader return by Next() function.\nIt will fill the **p []byte** with the decompressed bytes of current file.\n## Installation \n```\ngo get -v \"github.com/dipakpatil804/zipstream\"\n```\n\n## Sample Example\n```\n    f, err := os.Open(\"~/sample.zip\")\n\tif err != nil {\n\t\tfmt.Printf(\"Failed to open file.\\n\")\n\t\treturn\n\t}\n\n\tz := zipstream.ZipStream{Reader: f}\n\tfor {\n\t\tlfh, r, err := z.Next()\n\t\tif err == io.EOF {\n\t\t\tfmt.Printf(\"Done Reading Zip\\n\")\n\t\t\treturn\n\t\t}\n\t\tfmt.Printf(\"Reading file: %s\\n\", lfh.FileName)\n\t\t\n\t\tif lfh.IsDirectory {\n\t\t\tcontinue\n\t\t}\n\n\t\tio.Copy(ioutil.Discard, r)\n\t\tif err == io.EOF {\n\t\t\tbreak\n\t\t} else if err != nil {\n\t\t\tfmt.Printf(\"Error: %s\", err.Error())\n\t\t\treturn\n\t\t}\n\t}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdipakpatil804%2Fzipstream","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdipakpatil804%2Fzipstream","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdipakpatil804%2Fzipstream/lists"}