Skip to content

tenmozes/gozstd

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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, linux/arm, linux/arm64, 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/ARCH. How to rebuild them? A: Just run make clean libzstd.a if your OS/ARCH 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

About

go wrapper for zstd

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C 86.4%
  • C++ 2.8%
  • Shell 2.3%
  • HTML 2.0%
  • Makefile 1.8%
  • Go 1.6%
  • Other 3.1%