{"id":13413498,"url":"https://github.com/gen2brain/go-unarr","last_synced_at":"2025-05-15T18:10:16.895Z","repository":{"id":37484124,"uuid":"45334904","full_name":"gen2brain/go-unarr","owner":"gen2brain","description":"Go bindings for unarr (decompression library for RAR, TAR, ZIP and 7z archives)","archived":false,"fork":false,"pushed_at":"2024-10-22T17:24:48.000Z","size":933,"stargazers_count":291,"open_issues_count":2,"forks_count":46,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-04-08T00:35:34.568Z","etag":null,"topics":["7z-archives","7zip","decompression-library","golang","golang-library","rar","rar-format","tar"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"zlib","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gen2brain.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":"2015-11-01T09:38:37.000Z","updated_at":"2025-04-03T00:25:27.000Z","dependencies_parsed_at":"2023-11-30T11:31:09.629Z","dependency_job_id":"cb68afaa-ec27-48b6-be51-b9760aef6777","html_url":"https://github.com/gen2brain/go-unarr","commit_stats":{"total_commits":121,"total_committers":6,"mean_commits":"20.166666666666668","dds":"0.11570247933884292","last_synced_commit":"7a3539ca722cc1e3c10b32df01954a82ddc5db80"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gen2brain%2Fgo-unarr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gen2brain%2Fgo-unarr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gen2brain%2Fgo-unarr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gen2brain%2Fgo-unarr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gen2brain","download_url":"https://codeload.github.com/gen2brain/go-unarr/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254394724,"owners_count":22063984,"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":["7z-archives","7zip","decompression-library","golang","golang-library","rar","rar-format","tar"],"created_at":"2024-07-30T20:01:41.726Z","updated_at":"2025-05-15T18:10:16.846Z","avatar_url":"https://github.com/gen2brain.png","language":"Go","readme":"# go-unarr\n\n[![Build Status](https://github.com/gen2brain/go-unarr/actions/workflows/test.yml/badge.svg)](https://github.com/gen2brain/go-unarr/actions)\n[![GoDoc](https://godoc.org/github.com/gen2brain/go-unarr?status.svg)](https://godoc.org/github.com/gen2brain/go-unarr)\n[![Go Report Card](https://goreportcard.com/badge/github.com/gen2brain/go-unarr?branch=master)](https://goreportcard.com/report/github.com/gen2brain/go-unarr)\n\n\u003e Golang bindings for the [unarr](https://github.com/selmf/unarr) library from sumatrapdf.\n\n`unarr` is a decompression library and CLI for RAR, TAR, ZIP and 7z archives.\n\n## GoDoc\n\nSee \u003chttps://pkg.go.dev/github.com/gen2brain/go-unarr\u003e\n\n## Build tags\n\n* `extlib` - use external libunarr library\n* `pkgconfig` - enable pkg-config (used with `extlib`)\n* `static` - use static library (used with `pkgconfig`)\n\n## Install CLI\n\n```bash\ngo install github.com/gen2brain/go-unarr/cmd/unarr@latest\n```\n\n#### Example\n\n```bash\nunarr ./example.7z ./example/\n```\n\n#### Build\n\nFor one-off builds:\n\n```bash\ngo build -o ./unarr ./cmd/unarr/*.go\n```\n\nFor multi-platform cross-compile builds:\n\n```bash\ngoreleaser --snapshot --skip-publish --rm-dist\n```\n\n## Library Examples\n\n#### Install Library\n\n```bash\ngo get -v github.com/gen2brain/go-unarr\n```\n\n#### Open archive\n\n```go\na, err := unarr.NewArchive(\"test.7z\")\nif err != nil {\n    panic(err)\n}\ndefer a.Close()\n```\n\n#### Read first entry from archive\n\n```go\nerr := a.Entry()\nif err != nil {\n    panic(err)\n}\n\ndata, err := a.ReadAll()\nif err != nil {\n    panic(err)\n}\n```\n\n#### List contents of archive\n\n```go\nlist, err := a.List()\nif err != nil {\n    panic(err)\n}\n```\n\n#### Read known filename from archive\n\n```go\nerr := a.EntryFor(\"filename.txt\")\nif err != nil {\n    panic(err)\n}\n\ndata, err := a.ReadAll()\nif err != nil {\n    panic(err)\n}\n```\n\n#### Read first 8 bytes of the entry\n\n```go\nerr := a.Entry()\nif err != nil {\n    panic(err)\n}\n\ndata := make([]byte, 8)\n\nn, err := a.Read(data)\nif err != nil {\n    panic(err)\n}\n```\n\n#### Read all entries from archive\n\n```go\nfor {\n    err := a.Entry()\n    if err != nil {\n        if err == io.EOF {\n            break\n        } else {\n            panic(err)\n        }\n    }\n\n    data, err := a.ReadAll()\n    if err != nil {\n        panic(err)\n    }\n}\n```\n\n#### Extract contents of archive to destination path\n\n```go\n_, err := a.Extract(\"/tmp/path\")\nif err != nil {\n    panic(err)\n}\n```\n","funding_links":[],"categories":["Miscellaneous","Uncategorized","杂项","Microsoft Office","其他杂项","其他","\u003cspan id=\"其他-miscellaneous\"\u003e其他 Miscellaneous\u003c/span\u003e"],"sub_categories":["Uncategorized","Strings","Advanced Console UIs","未分类的","暂未分类","暂未分类这些库被放在这里是因为其他类别似乎都不适合。","交流","\u003cspan id=\"高级控制台用户界面-advanced-console-uis\"\u003e高级控制台用户界面 Advanced Console UIs\u003c/span\u003e"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgen2brain%2Fgo-unarr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgen2brain%2Fgo-unarr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgen2brain%2Fgo-unarr/lists"}