Code Monkey home page Code Monkey logo

luajit-zstd's Introduction

Name

luajit-zstd - facebook zstandard ffi binding

Installation

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.

Example

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 [email protected]

License

Public Domain

luajit-zstd's People

Contributors

sjnam avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

luajit-zstd's Issues

calling global ZSTD_getErrorName

I think you should fix:

return nil, "ZSTD_decompressStream() error: "
..ZSTD_getErrorName(rlen)
=>
return nil, "ZSTD_decompressStream() error: "
..zstd.ZSTD_getErrorName(rlen)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.