Uncompress zlib compressed stream
Monday, April 14, 2008 at 9:59AM
Captain Rtfb in Linux, Tips and Tricks, zlib

Today I encountered a file which was compressed but I was unable to see what compression method was used. The header started with 78 9c ec. Good friend Google told me that it could be a Zlib compression. But how to use the Zlib library from the command line?

Fortunately PHP has a command available, gzuncompress(). A short piece of php code uncompresses the file for me:

$handle = fopen($file, "r");
$inhoud=fread($handle, filesize($file));
$uncompressed = gzuncompress($inhoud);
echo $uncompressed;

Article originally appeared on dutchtechies (http://dutchtechies.com/).
See website for complete article licensing information.