Nim wrapper for LZ4
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()
.
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)