1 unstable release
|0.1.0||Aug 25, 2017|
#18 in #gzip
[dependencies] nom-gzip = "0.1.0"
Three functions are available:
Once the GZIP header has been parsed, the remaining data are the compressed
blocks and an 8-byte footer. If using a seekable stream it's recommended
to parse the header with
gzip_header, grab the remaining bytes - minus
the 8 at the end - as the compressed blocks, then call
on the remaining 8 bytes. This should be considerably faster than parsing
byte-by-byte looking for the end of stream.
This parser assumes the GZIP stream contains only a single compressed file that goes until EOF.
While in theory multiple files can be in a single GZIP stream by simply concatenating multiple GZIP files together (see section 2.2 of the RFC), in practice it appears that at least GNU GZIP and 7z do not correctly support this. For two files cat'd together they both report the header of the first file with the footer (uncompressed size of the file) from the second. Decompression of such a file with the gzip utility results in the uncompressed contents of both files concatenated together in a single file instead of two files with separated content. IMHO if this feature of the GZIP format can't be used in any practical sense there is no point in spending time writing a theoretically correct but far more involved (and slower!) parser here.