{"id":13575872,"url":"https://github.com/valyala/gozstd","last_synced_at":"2025-05-14T04:07:09.291Z","repository":{"id":31224647,"uuid":"127268366","full_name":"valyala/gozstd","owner":"valyala","description":"go wrapper for zstd","archived":false,"fork":false,"pushed_at":"2024-10-15T16:49:41.000Z","size":37778,"stargazers_count":448,"open_issues_count":22,"forks_count":65,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-04-10T22:34:55.454Z","etag":null,"topics":["compression","dictionary","go","golang","streaming","zstd"],"latest_commit_sha":null,"homepage":null,"language":"C","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/valyala.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":"2018-03-29T09:23:26.000Z","updated_at":"2025-03-28T07:03:19.000Z","dependencies_parsed_at":"2024-01-14T03:49:33.626Z","dependency_job_id":"d1dd3df6-5626-44f2-8bc0-c070cfc4ab0b","html_url":"https://github.com/valyala/gozstd","commit_stats":{"total_commits":172,"total_committers":19,"mean_commits":9.052631578947368,"dds":0.2906976744186046,"last_synced_commit":"d0e6ac601c125c5b719a0725259f0f4b5fbb903e"},"previous_names":[],"tags_count":41,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valyala%2Fgozstd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valyala%2Fgozstd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valyala%2Fgozstd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valyala%2Fgozstd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/valyala","download_url":"https://codeload.github.com/valyala/gozstd/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254067718,"owners_count":22009240,"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":["compression","dictionary","go","golang","streaming","zstd"],"created_at":"2024-08-01T15:01:04.972Z","updated_at":"2025-05-14T04:07:04.277Z","avatar_url":"https://github.com/valyala.png","language":"C","readme":"[![Build Status](https://travis-ci.org/valyala/gozstd.svg)](https://travis-ci.org/valyala/gozstd)\n[![GoDoc](https://godoc.org/github.com/valyala/gozstd?status.svg)](http://godoc.org/github.com/valyala/gozstd)\n[![Go Report](https://goreportcard.com/badge/github.com/valyala/gozstd)](https://goreportcard.com/report/github.com/valyala/gozstd)\n[![codecov](https://codecov.io/gh/valyala/gozstd/branch/master/graph/badge.svg)](https://codecov.io/gh/valyala/gozstd)\n\n# gozstd - go wrapper for [zstd](http://facebook.github.io/zstd/)\n\n\n## Features\n\n  * Vendors upstream [zstd](https://github.com/facebook/zstd) without any modifications.\n  * [Simple API](https://godoc.org/github.com/valyala/gozstd).\n  * Optimized for speed. The API may be easily used in zero allocations mode.\n  * `Compress*` and `Decompress*` functions are optimized for high concurrency.\n  * Proper [Writer.Flush](https://godoc.org/github.com/valyala/gozstd#Writer.Flush)\n    for network apps.\n  * Supports the following features from upstream [zstd](https://facebook.github.io/zstd/):\n      * Block / stream compression / decompression with all the supported compression levels\n        and with dictionary support.\n      * [Dictionary](https://github.com/facebook/zstd#the-case-for-small-data-compression)\n        building from a sample set. The created dictionary may be saved to persistent storage /\n\ttransfered over the network.\n      * Dictionary loading for compression / decompression.\n      \n    Pull requests for missing upstream `zstd` features are welcome.\n\n## Quick start\n\n\n### How to install `gozstd`?\n\n```\ngo get -u github.com/valyala/gozstd\n```\n\n### How to compress data?\n\nThe easiest way is just to use [Compress](https://godoc.org/github.com/valyala/gozstd#Compress):\n\n```go\n\tcompressedData := Compress(nil, data)\n```\n\nThere is also [StreamCompress](https://godoc.org/github.com/valyala/gozstd#StreamCompress)\nand [Writer](https://godoc.org/github.com/valyala/gozstd#Writer) for stream compression.\n\n### How to decompress data?\n\nThe easiest way is just to use [Decompress](https://godoc.org/github.com/valyala/gozstd#Decompress):\n\n```go\n\tdata, err := Decompress(nil, compressedData)\n```\n\nThere is also [StreamDecompress](https://godoc.org/github.com/valyala/gozstd#StreamDecompress)\nand [Reader](https://godoc.org/github.com/valyala/gozstd#Reader) for stream decompression.\n\n### How to cross-compile gozstd?\n\nIf you're cross-compiling some code that uses gozstd and you stumble upon the following error:\n```\n# github.com/valyala/gozstd\n/go/pkg/mod/github.com/valyala/gozstd@v1.6.2/stream.go:31:59: undefined: CDict\n/go/pkg/mod/github.com/valyala/gozstd@v1.6.2/stream.go:35:64: undefined: CDict\n/go/pkg/mod/github.com/valyala/gozstd@v1.6.2/stream.go:47:20: undefined: Writer\n```\n\nYou can easily fix it by enabling [CGO](https://golang.org/cmd/cgo/) and using a cross-compiler (e.g. `arm-linux-gnueabi-gcc`):\n```bash\nenv CC=arm-linux-gnueabi-gcc GOOS=linux GOARCH=arm CGO_ENABLED=1 go build ./main.go \n```\n\n**NOTE**: Check [#21](https://github.com/valyala/gozstd/issues/21) for more info.\n\n### Who uses gozstd?\n\n* [VictoriaMetrics](https://github.com/VictoriaMetrics/VictoriaMetrics)\n\n## FAQ\n\n  * Q: _Which go version is supported?_\n    A: `go1.10` and newer. Pull requests for older go versions are accepted.\n\n  * Q: _Which platforms/architectures are supported?_\n    A: `linux/amd64`, `linux/arm`, `linux/arm64`, `freebsd/amd64`, `darwin/amd64`, `darwin/arm64`, `windows/amd64`. Pull requests for other platforms/architectures\n       are accepted.\n\n  * Q: _I don't trust `libzstd*.a` binary files from the repo or these files dont't work on my OS/ARCH. How to rebuild them?_\n    A: Just run `make clean libzstd.a` if your OS/ARCH is supported.\n\n  * Q: _How do I specify custom build flags when recompiling `libzstd*.a`?_\n    A: You can specify MOREFLAGS=... variable when running `make` like this: `MOREFLAGS=-fPIC make clean libzstd.a`.\n\n  * Q: _Why the repo contains `libzstd*.a` binary files?_  \n    A: This simplifies package installation with `go get` without the need to perform additional steps for building the `libzstd*.a`.\n","funding_links":[],"categories":["C"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvalyala%2Fgozstd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvalyala%2Fgozstd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvalyala%2Fgozstd/lists"}