简体   繁体   中英

What is the format of the data compressed using zlib and how to uncompress them from command line or other apps?

I am using qCompress() to compress the data in a file. Now the requirement is that, this file should be un-compressible manually, either via command line or via some standard compression tool.

Since qCompress() uses zlib library, what should be the extension of that file (ie .zip, .gz, .bz etc)?
Also what kind of standalone cli tools should be used to de-compress such files?
(Programmatically we can use qUncompress() ).

The documentation is scant, but from what I can tell, qCompress() writes a four-byte length followed by a zlib stream. There is no file format, extension, nor command line tool for that format. You would have to write your own.

It would be quite straightforward. Just discard the first four bytes, and feed the rest to zlib (a C library likely already installed on your machine).

If you are on a Unixish system, you can use dd to strip the first four bytes, and then feed the resulting zlib stream to pigz -dz .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM