Compression libraries for Ruby?

Are there any Ruby libraries for compressing / decomposing open source? Has anyone implemented LZW?

Or are there open source libraries that use a compression component that you can possibly extract for your own use?

EDIT - thanks for the answers! I should have mentioned that I need to compress long lines that will only be in the database (I will not compress the files). Also, it would be ideal if any library could do this, there was an equivalent JavaScript implementation for client comp / decomp, as it would be for a web application.

+5
source share
4 answers

You will find a good list of all shipped ruby ​​libraries under ruby stdlib .

I would use the zlib library, it is open, it has been used everywhere, and you will find libraries for almost every language!

+5
source

zlib is great if you need more information about size than speed, or want to make sure that bindings in other languages ​​are compatible. For wire transfers, processor speed and load are often more important.

Several ruby ​​libs integrating much faster compression files: Google Snappy , QuickLZ, and LZO

+2
source

You can try ruby-lzws , bindings for the lzws library. It is compatible with UNIX compression.

gem install ruby-lzws require "lzws" data = LZWS::String.compress "TOBEORNOTTOBEORTOBEORNOT" puts LZWS::String.decompress(data) 

TOBEORNOTTOBEORTOBEORNOT

0
source

All Articles