Nim implementation of Snappy compression algorithm
Go to file
Zahary Karadjov 072c5eee43
Add an imlementation based on Nim std streams
2019-07-08 17:00:08 +03:00
tests Add an imlementation based on Nim std streams 2019-07-08 17:00:08 +03:00
.appveyor.yml fixes tests 2018-11-02 21:48:41 +07:00
.gitignore initial commit 2018-11-02 12:10:58 +07:00
.travis.yml fixes tests 2018-11-02 21:48:41 +07:00
LICENSE initial commit 2018-11-02 12:10:58 +07:00
readme.md add compress/uncompress alias 2018-11-02 20:36:21 +07:00
snappy.nim Add an imlementation based on Nim std streams 2019-07-08 17:00:08 +03:00
snappy.nimble Migrate to faststreams; WIP benchmark 2019-07-07 15:33:25 +03:00

readme.md

Snappy

Build Status (Travis) Windows build status (Appveyor) nimble license

Nim implementation of Snappy compression algorithm

Currently, this implementation only support block compression and no stream compression support at all.

API

  • proc encode*(src: openArray[byte]): seq[byte]
  • proc decode*(src: openArray[byte]): seq[byte]
  • template compress --- an alias to encode
  • template uncompress --- an alias to decode

Examples

import snappy
var source = readFile("readme.md")
var encoded = snappy.encode(toOpenArrayByte(source, 0, source.len-1))
var decoded = snappy.decode(encoded)
assert equalMem(decoded[0].addr, source[0].addr, source.len)

Installation via nimble

nimble install snappy