go wrapper for zstd
Switch branches/tags
Nothing to show
Clone or download
Permalink
Failed to load latest commit information.
zstd Updated upstream zstd to v1.3.6 Oct 11, 2018
.gitignore Ignore tags generated from `ctags -R` Mar 30, 2018
.travis.yml Update .travis.yml for new platform May 17, 2018
LICENSE added LICENSE Mar 30, 2018
Makefile Add compatibility with go1.11 modules Sep 5, 2018
README.md Format FAQ (#4) Oct 1, 2018
dict.go Add compatibility with go1.11 modules Sep 5, 2018
dict_example_test.go Typo fix in BuildDict example Apr 3, 2018
dict_test.go Added dictionary support Apr 2, 2018
go.mod Add compatibility with go1.11 modules Sep 5, 2018
gozstd.go Add compatibility with go1.11 modules Sep 5, 2018
gozstd_example_test.go Simplify examples for Compress/Decompress without allocs Apr 3, 2018
gozstd_test.go Reduced complexity for TestCompressDecompressDistinctConcurrentDicts Apr 4, 2018
gozstd_timing_test.go Rename *WithDict* -> *Dict* Apr 2, 2018
libzstd_darwin.a Rebuild on macOS 10.13.4/XCode 9.3.1(9E501) May 29, 2018
libzstd_darwin.go Rename files linkzstd_*.go to libzstd_*.go May 29, 2018
libzstd_linux.a Updated upstream zstd to v1.3.6 Oct 11, 2018
libzstd_linux.go Rename files linkzstd_*.go to libzstd_*.go May 29, 2018
libzstd_windows.a Rebuild on Windows10/tdm-gcc-5.1.0-2/MSYS2 May 29, 2018
libzstd_windows.go go fmt Jul 22, 2018
reader.go Add compatibility with go1.11 modules Sep 5, 2018
reader_example_test.go Added dictionary support Apr 2, 2018
reader_test.go Reader: properly read `compress bomb` - data with extremely high comp… Jul 27, 2018
reader_timing_test.go Rename *WithDict* -> *Dict* Apr 2, 2018
stream.go Mention that Stream* functions shouldn't be used with interactive net… Apr 6, 2018
stream_test.go gofmt Apr 4, 2018
stream_timing_test.go Added helper functions for stream compression / decompression Apr 3, 2018
writer.go Fix memory leaks in NewWriter* and fix errors detected by `GODEBUG=cg… Aug 2, 2018
writer_example_test.go Simplify Writer.Flush example Apr 6, 2018
writer_test.go Made TestWriterBig test closer to the production use case Jul 23, 2018
writer_timing_test.go Rename *WithDict* -> *Dict* Apr 2, 2018
zdict.h Updated upstream zstd to v1.3.6 Oct 11, 2018
zstd.h Updated upstream zstd to v1.3.6 Oct 11, 2018
zstd_errors.h Add compatibility with go1.11 modules Sep 5, 2018

README.md

Build Status GoDoc Go Report codecov

gozstd - go wrapper for zstd

Features

  • Vendors upstream zstd without any modifications.

  • Simple API.

  • Optimized for speed. The API may be easily used in zero allocations mode.

  • Compress* and Decompress* functions are optimized for high concurrency.

  • Proper Writer.Flush for network apps.

  • Supports the following features from upstream zstd:

    • Block / stream compression / decompression with all the supported compression levels and with dictionary support.
    • Dictionary building from a sample set. The created dictionary may be saved to persistent storage / transfered over the network.
    • Dictionary loading for compression / decompression.

    Pull requests for missing upstream zstd features are welcome.

Quick start

How to install gozstd?

go get -u github.com/valyala/gozstd

How to compress data?

The easiest way is just to use Compress:

	compressedData := Compress(nil, data)

There is also StreamCompress and Writer for stream compression.

How to decompress data?

The easiest way is just to use Decompress:

	data, err := Decompress(nil, compressedData)

There is also StreamDecompress and Reader for stream decompression.

FAQ

  • Q: Which go version is supported?
    A: go1.10 and newer. Pull requests for older go versions support are accepted.

  • Q: Which platforms/architectures are supported?
    A: linux/amd64,darwin/amd64,windows/amd64. Pull requests for other platforms/architectures support are accepted.

  • Q: I don't trust libzstd*.a binary files from the repo or these files dont't work on my OS/architecture. How to rebuild them?
    A: Just run make clean libzstd.a if your OS/architecture is supported.

  • Q: Why the repo contains libzstd*.a binary files?
    A: This simplifies package installation to usual go get without additional steps for building the libzstd*.a