{"id":26826696,"url":"https://github.com/hslam/compress","last_synced_at":"2025-03-30T11:30:37.751Z","repository":{"id":55579093,"uuid":"220085696","full_name":"hslam/compress","owner":"hslam","description":"Package compress implements compressing and uncompressing in golang.","archived":false,"fork":false,"pushed_at":"2020-12-21T02:36:06.000Z","size":18,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-06-21T13:39:20.901Z","etag":null,"topics":[],"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/hslam.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}},"created_at":"2019-11-06T20:40:38.000Z","updated_at":"2020-12-21T02:36:08.000Z","dependencies_parsed_at":"2022-08-15T03:31:13.550Z","dependency_job_id":null,"html_url":"https://github.com/hslam/compress","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hslam%2Fcompress","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hslam%2Fcompress/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hslam%2Fcompress/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hslam%2Fcompress/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hslam","download_url":"https://codeload.github.com/hslam/compress/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246313609,"owners_count":20757446,"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":[],"created_at":"2025-03-30T11:30:36.676Z","updated_at":"2025-03-30T11:30:37.729Z","avatar_url":"https://github.com/hslam.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# compress\n[![GoDoc](https://godoc.org/github.com/hslam/compress?status.svg)](https://godoc.org/github.com/hslam/compress)\n[![Build Status](https://github.com/hslam/compress/workflows/build/badge.svg)](https://github.com/hslam/compress/actions)\n[![codecov](https://codecov.io/gh/hslam/compress/branch/master/graph/badge.svg)](https://codecov.io/gh/hslam/compress)\n[![Go Report Card](https://goreportcard.com/badge/github.com/hslam/compress)](https://goreportcard.com/report/github.com/hslam/compress)\n[![GitHub release](https://img.shields.io/github/release/hslam/compress.svg)](https://github.com/hslam/compress/releases/latest)\n[![LICENSE](https://img.shields.io/github/license/hslam/compress.svg?style=flat-square)](https://github.com/hslam/compress/blob/master/LICENSE)\n\nPackage compress implements compressing and uncompressing in golang.\n\n## Feature\n* flate\n* zlib\n* gzip\n\n## Get started\n\n### Install\n```\ngo get github.com/hslam/compress\n```\n### Import\n```\nimport \"github.com/hslam/compress\"\n```\n### Usage\n#### Example\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"github.com/hslam/compress\"\n)\n\nvar readyBytes = []byte(\"DhPNExsTOYfCZrzQ2wPcHDHqtSJAS7gMLeqejz6ZvLf9QIZxoYGy8ooaJfS12mbUTeg0bCiwpdukKbYPP1LgxNulu7qQJMtr1WQ0boTtnJiRXsN6r0W7q7f3dh5lRZVVhwlVOupxD4D7i0YWKvsJGkSIATQtZGsPcOBKspKN6vu3ugxaO8Jv2jYtm3MB2RwokaXlRjr37whZyr8Tam3rM9OGinGfSKCwUeTzLhg2dz83slIsCdO3lqzkx9iBWyaBtDebfYN465CAndAJN1JqFzhRfaXcw9KNPBUHn3CGioQTTrWzrIWiHTi70zPDSiFRjmLQdJKKgCpVgtk20DHFcFme7dUlV4l5RFWHUoNea9FUN1cFvnyZVYpCnZz3uPgpa1dE3DkSodQMAYJZOpeB29EnyYj4UKvDehxqVAwgDyMS82PXbbi4H6UPiwOX9IomXGvL8jUt441ENrfXObR6kEjSstjnQ6pEX9VchH66cMlFE4qgRUkvKFIycfw5F208\")\n\nfunc main() {\n\tFlate()\n\tZlib()\n\tGzip()\n}\n\n//Flate Example\nfunc Flate() {\n\tcompressor := \u0026compress.Compressor{Type: compress.Flate, Level: compress.DefaultCompression}\n\tcompressBytes := compressor.Compress(readyBytes)\n\tuncompressBytes := compressor.Uncompress(compressBytes)\n\tfmt.Printf(\"flat %d-\u003e%d-\u003e%d\\n\", len(readyBytes), len(compressBytes), len(uncompressBytes))\n}\n\n//Zlib Example\nfunc Zlib() {\n\tcompressor := \u0026compress.Compressor{Type: compress.Zlib, Level: compress.DefaultCompression}\n\tcompressBytes := compressor.Compress(readyBytes)\n\tuncompressBytes := compressor.Uncompress(compressBytes)\n\tfmt.Printf(\"zlib %d-\u003e%d-\u003e%d\\n\", len(readyBytes), len(compressBytes), len(uncompressBytes))\n}\n\n//Gzip Example\nfunc Gzip() {\n\tcompressor := \u0026compress.Compressor{Type: compress.Gzip, Level: compress.DefaultCompression}\n\tcompressBytes := compressor.Compress(readyBytes)\n\tuncompressBytes := compressor.Uncompress(compressBytes)\n\tfmt.Printf(\"gzip %d-\u003e%d-\u003e%d\\n\", len(readyBytes), len(compressBytes), len(uncompressBytes))\n}\n```\n\n### Output\n```\nflat 512-\u003e410-\u003e512\nzlib 512-\u003e412-\u003e512\ngzip 512-\u003e420-\u003e512\n```\n\n### Benchmark\ngo test -v -run=\"none\" -bench=. -benchtime=1s -benchmem\n```\ngoos: darwin\ngoarch: amd64\npkg: github.com/hslam/compress\nBenchmarkFlate-4   \t    6006\t    194793 ns/op\t  857312 B/op\t      27 allocs/op\nBenchmarkZlib-4    \t    6276\t    199555 ns/op\t  858042 B/op\t      33 allocs/op\nBenchmarkGzip-4    \t    6139\t    197678 ns/op\t  858720 B/op\t      30 allocs/op\nPASS\nok  \tgithub.com/hslam/compress\t4.902s\n```\n\n### License\nThis package is licensed under a MIT license (Copyright (c) 2019 Meng Huang)\n\n### Authors\ncompress was written by Meng Huang.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhslam%2Fcompress","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhslam%2Fcompress","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhslam%2Fcompress/lists"}