Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there an official (or common) file extention or suffix for deflated files?

Gzipped files typically end in .gz. But, is there an official (or common) file extension or suffix for deflated files? I could not find any.

like image 800
Jérôme Verstrynge Avatar asked Mar 21 '12 14:03

Jérôme Verstrynge


People also ask

What is a deflated file?

In computing, Deflate (stylized as DEFLATE) is a lossless data compression file format that uses a combination of LZ77 and Huffman coding. It was designed by Phil Katz, for version 2 of his PKZIP archiving tool. Deflate was later specified in RFC 1951 (1996).

Is DEFLATE same as GZIP?

DEFLATE is a very popular compression algorithm which generally wraps up data using the LZ77, algorithm and Huffman coding. GZIP is a file format that uses DEFLATE internally, along with some interesting blocking, filtering heuristics, a header and a checksum.

What is the extension of file type file?

The extension is a three- or four-letter abbreviation that signifies the file type. For example, in letter. docx the filename is letter and the extension is docx. Extensions are important because they tell your computer what icon to use for the file, and what application can open the file.


1 Answers

There is an extension defined for zlib-wrapped (RFC-1950) deflate-compressed (RFC-1951) files, which is ".zz". There is no extension defined for raw deflate-compressed data (RFC-1951) that I know of. In general raw deflate data is only used within the context of some other data stream or file format.

The Java documentation is not clear about what is produced, but it looks like the default Deflater produces zlib-wrapped deflate data, unless the nowrap boolean is true in which case raw deflate-compressed data is produced.


More background

It's interesting to see that folk tend to think that all of these formats can be interpreted by anything that reads one of them, simply because the core compressed format (deflate) is the same. That is not the case. The gzip utility can read gzip-wrapped deflate data or single-entry zip files (and some legacy formats unrelated to deflate), but not zlib or raw deflate.

Info-ZIP's unzip can only read the ZIP format, which can include deflate data as one of the compressed data formats (there are others). zlib is a library, not a utility, and provides direct support for reading and writing the zlib format (a very compact wrapper around deflate data), the gzip format, and the raw deflate format with no wrapper. The latter can be used by other utilities to process deflate data in other formats, such as ZIP.

You can write your own zipper and unzipper using zlib to handle the heavy lifting for compression and decompression (as well as crc calculation), but you would have to handle all of the complexities of the ZIP format headers, trailers, and central dictionaries. pigz can read gzip, single-entry zip files, and the zlib format (as well as the old compress format).

like image 119
Mark Adler Avatar answered Sep 20 '22 04:09

Mark Adler