Skip to content
A pure Go implementation of the smaz compression library for short strings.
Go
Find file
Latest commit 96b046e Feb 9, 2016 @cespare Pull in trie package
This also inlines a lot of unnecessary methods, for a ~22% compression
speedup.
Failed to load latest commit information.
testdata Initial commit. Sep 12, 2012
LICENSE Big code cleanup Jul 10, 2014
README.md Godoc badge Jan 21, 2015
smaz.go Pull in trie package Feb 9, 2016
smaz_test.go Pull in trie package Feb 9, 2016

README.md

go-smaz

GoDoc

go-smaz is a pure Go implementation of antirez's smaz, a library for compressing short strings (particularly containing English words).

Installation

$ go get github.com/cespare/go-smaz

Usage

import (
  "github.com/cespare/go-smaz"
)

func main() {
  s := "Now is the time for all good men to come to the aid of the party."
  compressed := smaz.Compress([]byte(s))           // type is []byte
  decompressed, err := smaz.Decompress(compressed) // type is []byte; string(decompressed) == s
  if err != nil {
    ...
}

Also see the API documentation.

Notes

go-smaz is not a direct port of the C version. It is not guaranteed that the output of smaz.Compress will be precisely the same as the C library. However, the output should be decompressible by the C library, and the output of the C library should be decompressible by smaz.Decompress.

Author

Caleb Spare (cespare). smaz was created by Salvatore Sanfilippo (antirez).

Contributors

License

MIT Licensed.

Other implementations

Something went wrong with that request. Please try again.