luajit-zstd - facebook zstandard ffi binding
To install luajit-zstd
you need to install
Zstandard
with shared libraries firtst.
Then you can install luajit-zstd
by placing lib/zstd.lua
to
your lua library path.
local zstandard = require "zstd"
local zstd = zstandard:new()
local txt = string.rep("ABCD", 1000)
print("Uncompressed size:", #txt)
local c, err = zstd:compress(txt)
print("Compressed size:", #c)
local txt2, err = zstd:decompress(c)
assert(txt == txt2)
zstd:free()
syntax: zstd = zstandard:new()
Create cstream and dstream.
syntax: zstd:free()
Free cstream and dstream.
syntax: encoded_buffer, err = zstd:compress(input_buffer, clvl)
Compresses the data in input_buffer into encoded_buffer.
syntax: decoded_buffer, err = zstd:decompress(encoded_buffer)
Decompresses the data in encoded_buffer into decoded_buffer.
syntax: ok, err = zstd:compressFile(path, clvl?)
Compresses the input file with clvl compression level.
syntax: ok, err = zstd:decompressFile(fname, outname?)
Decompress the input file fname.
syntax: ok, err = zstd:compressFileUsingDictionary(path, dict, clvl?)
Compresses the input file with clvl compression level using a digested Dictionary.
syntax: ok, err = zstd:decompressFileUsingDictionary(fname, dict, outname?)
Decompress the input file fname using a digested Dictionary.
Soojin Nam jsunam@gamil.com
Public Domain