gziprb
is a pure-Ruby implementation of the famous GZIP/DEFLATE
format. It is (definitely!) not optimised for performance, but was instead
created as a learning exercise to try and better understand the gzip format.
To compress a file use gziprb INPUT_FILE
, which will create INPUT_FILE.gz
and not alter INPUT_FILE
.
To decompress a file use gunziprb INPUT_FILE.gz
, which will create
INPUT_FILE
and will not alter INPUT_FILE.gz
.
gziprb
is tested with unit tests (using RSpec) and shell integration
tests (using bats). To run all tests, use bundle exec rake test
(or just
bundle exec rake
as test
is the default task).
bats and its extension libraries should be installed via the included
npm
package.json
using npm install
.
In addition to the npm
dependency, the integration tests use gzip/gunzip,
which may not be availabe, so only the unit tests can be run by using bundle exec rake spec
. Similarly, just the integration tests can be run with bundle exec rake integration_test
.
The official gzip repository contains puff.c a simple implementation of inflation of gzip-compressed files, which, along with Joshua Davies' blogpost were very useful when first trying to get to grips with the formats. Michael Dipperstein's blogpost contained several useful hints regarding LZ77.
Bug reports and pull requests are welcome on GitHub at https://github.com/owst/gziprb.