Skip to content

Latest commit

 

History

History
25 lines (20 loc) · 790 Bytes

README.md

File metadata and controls

25 lines (20 loc) · 790 Bytes

nimlz4

Nim wrapper for LZ4

Simple compression (block API)

Use this API when you don't care about interoperability and assume only this wrapper will be used to compress and decompress strings:

import lz4
var input = readFile("LICENSE")
var compressed = compress(input,level=1)
var uncompressed = uncompress(compressed)
echo(uncompressed==input)

If you would like a better compression ratio at the expense of CPU time, use compress_more().

Frame compression (auto-framing API)

Use the frame API when you want your compressed data to be decompressable by other programs.

import lz4
var prefs = newLZ4F_preferences()
var compressed = compress_frame(input,prefs)
var decompressed = uncompress_frame(compressed)
echo(input == decompressed)