nim-snappy/README.md

29 lines
1.1 KiB
Markdown
Raw Normal View History

2018-11-02 05:20:45 +00:00
# Snappy
2019-08-24 16:35:53 +00:00
[![Build Status](https://travis-ci.org/status-im/nim-snappy.svg?branch=master)](https://travis-ci.org/status-im/nim-snappy)
[![Build status](https://ci.appveyor.com/api/projects/status/g4y9874tx0biv3t1/branch/master?svg=true)](https://ci.appveyor.com/project/nimbus/nim-snappy/branch/master)
2018-11-02 05:20:45 +00:00
![nimble](https://img.shields.io/badge/available%20on-nimble-yellow.svg?style=flat-square)
![license](https://img.shields.io/github/license/citycide/cascade.svg?style=flat-square)
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]
2018-11-02 13:36:21 +00:00
* template compress --- an alias to encode
* template uncompress --- an alias to decode
2018-11-02 05:20:45 +00:00
## Examples
```Nim
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