I'm looking for a command line wrapper for the DEFLATE algorithm.
I have a file (git blob) that is compressed using DEFLATE, and I want to uncompress it. The gzip command does not seem to have an option to directly use the DEFLATE algorithm, rather than the gzip format.
Ideally I'm looking for a standard Unix/Linux tool that can do this.
edit: This is the output I get when trying to use gzip for my problem:
$ cat .git/objects/c0/fb67ab3fda7909000da003f4b2ce50a53f43e7 | gunzip
gzip: stdin: not in gzip format
You can use zlib-flate, like this:
It's there by default on my machine, but it's part of
qpdf - tools for and transforming and inspecting PDF files
if you need to install it.I've popped an
echo
on the end of the command, as it's easier to read the output that way.Here is a Ruby one-liner ( cd .git/ first and identify path to any object ):
pythonic one-liner:
Looks like Mark Adler has us in mind and wrote an example of just how to do this with: http://www.zlib.net/zpipe.c
It compiles with nothing more than
gcc -lz
and the zlib headers installed. I copied the resulting binary to my/usr/local/bin/zpipe
while working with git stuff.Why don't you just use git's tools to access the data? This should be able to read any git object: