https://github.com/sjnam/luajit-zstd
  
  
    Facebook zstandard ffi binding 
    https://github.com/sjnam/luajit-zstd
  
compresses zstandard
        Last synced: 6 months ago 
        JSON representation
    
Facebook zstandard ffi binding
- Host: GitHub
- URL: https://github.com/sjnam/luajit-zstd
- Owner: sjnam
- Archived: true
- Created: 2017-02-14T08:45:21.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2019-04-27T08:30:48.000Z (over 6 years ago)
- Last Synced: 2024-05-18T20:47:26.684Z (over 1 year ago)
- Topics: compresses, zstandard
- Language: Lua
- Homepage:
- Size: 58.6 KB
- Stars: 26
- Watchers: 2
- Forks: 3
- Open Issues: 2
- 
            Metadata Files:
            - Readme: README.md
 
Awesome Lists containing this project
- awesome-resty - lua-resty-zstd
README
          Name
====
luajit-zstd - facebook [zstandard](https://github.com/facebook/zstd) ffi binding
Installation
============
To install `luajit-zstd` you need to install
[Zstandard](https://github.com/facebook/zstd#build)
with shared libraries firtst.
Then you can install `luajit-zstd` by placing `lib/zstd.lua` to
your lua library path.
Example
=======
```` lua
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()
````
Methods
=======
new
---
`syntax: zstd = zstandard:new()`
Create cstream and dstream.
free
----
`syntax: zstd:free()`
Free cstream and dstream.
compress
--------
`syntax: encoded_buffer, err = zstd:compress(input_buffer, clvl)`
Compresses the data in input_buffer into encoded_buffer.
decompress
----------
`syntax: decoded_buffer, err = zstd:decompress(encoded_buffer)`
Decompresses the data in encoded_buffer into decoded_buffer.
compressFile
--------------
`syntax: ok, err = zstd:compressFile(path, clvl?)`
Compresses the input file with clvl compression level.
decompressFile
--------------
`syntax: ok, err = zstd:decompressFile(fname, outname?)`
Decompress the input file fname.
compressFileUsingDictionary
--------------
`syntax: ok, err = zstd:compressFileUsingDictionary(path, dict, clvl?)`
Compresses the input file with clvl compression level using a digested Dictionary.
decompressFileUsingDictionary
--------------
`syntax: ok, err = zstd:decompressFileUsingDictionary(fname, dict, outname?)`
Decompress the input file fname using a digested Dictionary.
Author
======
Soojin Nam jsunam@gamil.com
License
=======
Public Domain