4
votes

I'm searching for an ultra-light gzip compression/decompression library in C++ (something definitively lighter than zlib) on a libral (BSD, MIT, PD) license. Googling revealed many libraries, but either they are bloated (like GZ compression in Crypto++) or on a more restrictive license.

It's hard to believe for me, that there's no lightweight free gz implementation...

Preferably C++ (I need to have it in the form of a stream) but C would be ok.

3
are you stuck with gzip compression? - Gregory Pakosz
Not exactly. But if I'd choose another one, it'd need to be one that is widely supported (AS3, PHP, Python). - Kornel Kisielewicz
I was about to mention LibLZF and FastLZ but i don't think they provide bindings for other languages than C and C++ - Gregory Pakosz
What's not lightweight about zlib? Is it in terms of code size? Or in terms of API? zlib has a simplified API where you can (de)compress an in-memory byte stream into another buffer with a single function call. - blwy10
If the algorithm is supported in other languages that's enough. I just want it to be lightweight from C++'s side. - Kornel Kisielewicz

3 Answers

6
votes

Statically linked zlib is probably the lightest you can get, it also has a rather nice and generously permissive license.

If it really isn't light enough, even considering what the linker will strip out, then chopping it down to size yourself might be a viable option.

0
votes

zlib utility functions

These are pretty lightweight. Generally all it takes is a single function call, assuming all your data is already in the appropriate buffers, which should be easy enough. If you want something even more lightweight than this (which may not be in the grand scheme of things as you potentially need to manage more dependencies), what klamlaluno posted looks good.