Build Status Build status AppVeyor tests branch codecov.io license LuaRocks

LibDeflate v0.9.0-alpha2

Pure Lua DEFLATE/zlib compressors and decompressors.

Copyright (C) 2018 Haoqian He

Introduction

LibDeflate is a pure Lua DEFLATE/zlib compressors and decompressors, which compress almost as good as zlib. LibDeflate does not have any dependencies except you need to have a working Lua interpreter.

Supported Lua Versions

LibDeflate supports and is fully tested under Lua 5.1/5.2/5.3, LuaJIT 2.0/2.1, for Linux, MaxOS and Windows. See the badge on the top of this README for the test result.

Documentation

Documentation is in the Github repository.

Limitation

Though many performance optimization has been done in the source code, as a pure lua implementation, its speed is significantly slower than a C compressor. LibDeflate aims to compress small files, and it is suggestted to not compress files bigger than 1MB. If you need to compress files hundreds of MetaBytes, please use a C compressor, or a Lua compressor with C binding.

Performance

Below is a simple benchmark compared with another pure Lua compressor LibCompress. LibDeflate with compressino level 1 compresses as fast as LibCompress, but already produces significantly smaller file than LibCompress. High compression level takes a bit more time to get better compression.

The size of The input data is 158492 bytes. The benchmark runs on Lua 5.1.4 interprefer.

NOTE: The compression method used by LibDeflate here is LibDeflate:CompressDeflate (Compress using raw DEFLATE format)

LibDeflate LibDeflate LibDeflate LibCompress LibCompress
level 1 level 5 level 8 CompressLZW CompressHuffman
Compress(ms) 65 150 465 66 75
Decompress(ms) 32 28 28 21 99
compress size(Bytes) 23659 17323 16106 72639 99346

Download And Install

The official repository locates on Github. LibDeflate.lua is the only file of LibDeflate. Copy the file to your LUA_PATH to install it.

To download as a World of Warcraft library, goto LibDeflate Curseforge Page

Usage

See examples/example.lua

Credits

1. zlib, by Jean-loup Gailly (compression) and Mark Adler (decompression). Licensed under zlib License. 2. puff, by Mark Adler. Licensed under zlib License. 3. LibCompress, by jjsheets and Galmok of European Stormrage (Horde). Licensed under GPLv2. 4. WeakAuras2. Licensed under GPLv2.

License

LibDeflate is licensed under GNU General Public License Version 3 or later.

generated by LDoc 1.4.6 Last updated 2018-05-22 21:45:58