Pure Lua LZ4 library

i’ve spent the past week with this lol, so many weird edgecases

lz4-lua

A pure Lua implementation of the LZ4 compression algorithm

LZ4 is a compression algorithm that uses dictionary-based matching to compress data. It compressess data into a block format.

This library attempts to work with the block format, and compress to it using a different algorithm (probably) to the C++ library. That being said, it should still work with the C++ tools and decompress C++ encoded data.

Source Code

Documentation

To compress a stream:

lz4.compress(data)

To decompress a stream:

lz4.decompress(data)

Notes

This library could definitely be more well optimised. Feel free to contribute optimisations on the GitHub, for whatever reason, data compressed with this may not work with the native decompressor

13 Likes

i might compare this with LZW, ill keep updated on how this goes

Wouldn’t it be better to compare LZ4 and LZW in their native languages and not use a port?. lz4’s original source code is hosted here

i want to compare your port with that. i will do it tommorow

I can no longer find this on GitHub.

2 Likes

Rehosted source code since there seems to be demand for this all of a sudden

1 Like