Skip to content

Add (full) gzip header/fields #39545

@mStirner

Description

@mStirner

gzip has a option/feature for extra header fields (https://datatracker.ietf.org/doc/html/rfc1952#section-2.3.1.1) & a comment field (https://datatracker.ietf.org/doc/html/rfc1952#page-5).
Would it be possible to implement to read/write these headers/fields?

I found no way/module that implement these functionality, although its is in the specification defined: https://datatracker.ietf.org/doc/html/rfc1952

 2.3. Member format
...
(if FLG.FEXTRA set)

         +---+---+=================================+
         | XLEN  |...XLEN bytes of "extra field"...| (more-->)
         +---+---+=================================+
...
 2.3.1.1. Extra field

         If the FLG.FEXTRA bit is set, an "extra field" is present in
         the header, with total length XLEN bytes.  It consists of a
         series of subfields, each of the form:

            +---+---+---+---+==================================+
            |SI1|SI2|  LEN  |... LEN bytes of subfield data ...|
            +---+---+---+---+==================================+

         SI1 and SI2 provide a subfield ID, typically two ASCII letters
         with some mnemonic value.  Jean-Loup Gailly
         <[email protected]> is maintaining a registry of subfield
         IDs; please send him any subfield ID you wish to use.  Subfield
         IDs with SI2 = 0 are reserved for future use.  The following
         IDs are currently defined:



Deutsch                      Informational                      [Page 8]


RFC 1952             GZIP File Format Specification             May 1996


            SI1         SI2         Data
            ----------  ----------  ----
            0x41 ('A')  0x70 ('P')  Apollo file type information

         LEN gives the length of the subfield data, excluding the 4
         initial bytes.

I hope this is not a libuv issue/feature thing and im right here, if not please apologize.
Also, i didnt found anything in the gzip docs (https://nodejs.org/dist/latest-v14.x/docs/api/zlib.html) where/how i can read the the checksum from the uncompressed tar file/input stream:

 2.3. Member format
...
 (if FLG.FHCRC set)

         +---+---+
         | CRC16 |
         +---+---+

         +=======================+
         |...compressed blocks...| (more-->)
         +=======================+

           0   1   2   3   4   5   6   7
         +---+---+---+---+---+---+---+---+
         |     CRC32     |     ISIZE     |
         +---+---+---+---+---+---+---+---+

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestIssues that request new features to be added to Node.js.stalezlibIssues and PRs related to the zlib subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions