{"id":27042541,"url":"https://github.com/go-apt/dpkg","last_synced_at":"2026-01-19T14:33:05.167Z","repository":{"id":281001375,"uuid":"943612475","full_name":"go-apt/dpkg","owner":"go-apt","description":"A Go package for managing Debian packages","archived":false,"fork":false,"pushed_at":"2025-03-10T21:27:00.000Z","size":1414,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-05T04:28:52.977Z","etag":null,"topics":["debian","dpkg","dpkg-deb","golang","golang-library","golang-package","hacktoberfest"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/go-apt/dpkg","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/go-apt.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":"2025-03-06T01:47:22.000Z","updated_at":"2025-03-10T21:27:02.000Z","dependencies_parsed_at":"2025-03-06T13:37:55.213Z","dependency_job_id":null,"html_url":"https://github.com/go-apt/dpkg","commit_stats":null,"previous_names":["go-apt/dpkg"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/go-apt/dpkg","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-apt%2Fdpkg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-apt%2Fdpkg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-apt%2Fdpkg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-apt%2Fdpkg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/go-apt","download_url":"https://codeload.github.com/go-apt/dpkg/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-apt%2Fdpkg/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28571793,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-19T12:50:50.164Z","status":"ssl_error","status_checked_at":"2026-01-19T12:50:42.704Z","response_time":67,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["debian","dpkg","dpkg-deb","golang","golang-library","golang-package","hacktoberfest"],"created_at":"2025-04-05T04:28:56.161Z","updated_at":"2026-01-19T14:33:05.147Z","avatar_url":"https://github.com/go-apt.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dpkg\n\n`dpkg` is a Go package for managing Debian packages. It provides functionalities to read and parse `.deb` files, list installed packages, and filter packages based on their names.\n\n## Installation\n\nTo install the `dpkg` package, use the following command:\n\n```sh\ngo get github.com/go-apt/dpkg\n```\n\n## Main Functions\n\n### Reading the Contents of a `.deb` File\n\nTo read the contents of a `.deb` file and retrieve its metadata, use the `Info` function:\n\n```go\n// Create a new instance of the Dpkg struct\nd := dpkg.NewDpkg()\n\n// Read the contents of the .deb file\npkg, err := d.Info(\"/path/to/debFile\")\nif err != nil {\n    fmt.Fprintf(os.Stderr, \"Error: %v\\n\", err)\n    os.Exit(1)\n}\n\n// Print package name from the .deb file\nfmt.Printf(\"Package from .deb file: %s\\n\", pkg.Fields[\"Package\"])\n```\n\n### Validating a `.deb` File\n\nTo validate if a file is a valid `.deb` package, use the `IsDebFile` function:\n\n```go\ndebFile := \"/path/to/debFile\"\n\n// Validate if the file is a .deb package\nif !d.IsDebFile(debFile) {\n    fmt.Fprintf(os.Stderr, \"Error: %s is not a valid .deb file\\n\", debFile)\n    os.Exit(1)\n}\n\nfmt.Printf(\"%s is a valid .deb file\\n\", debFile)\n```\n\n### Listing Installed Packages\n\nTo list the installed packages and retrieve their metadata, use the `List` function:\n\n```go\n// Create a new instance of the Dpkg struct\nd := dpkg.NewDpkg()\n\n// Read the contents of the /var/lib/dpkg/status file\npackages, err := d.List()\nif err != nil {\n    fmt.Fprintf(os.Stderr, \"Error: %v\\n\", err)\n    os.Exit(1)\n}\n\n// Print package names from installed packages\nfor _, p := range packages {\n    fmt.Printf(\"Package from dpkg status file: %s\\n\", p.Fields[\"Package\"])\n}\n```\n\n### Filtering Packages by Name\n\nTo filter packages by name, use the `ListGrep` function:\n\n```go\n// Create a new instance of the Dpkg struct\nd := dpkg.NewDpkg()\n\n// Filter packages by name\nfilteredPackages, err := d.ListGrep(\"apt\")\nif err != nil {\n    fmt.Fprintf(os.Stderr, \"Error: %v\\n\", err)\n    os.Exit(1)\n}\n\n// Print package names from filtered packages\nfor _, p := range filteredPackages {\n    fmt.Printf(\"Packages from Grep search: %s\\n\", p.Fields[\"Package\"])\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgo-apt%2Fdpkg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgo-apt%2Fdpkg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgo-apt%2Fdpkg/lists"}