TGZ to ZIP — unwinding gzip and tar, then writing one fresh archive
A source release named project.tar.gz combines a gzip compression wrapper with a TAR container. If your recipient or upload form requires ZIP, this route decompresses the wrapper, reads supported USTAR members and builds a ZIP at your chosen deflate level. Everything happens in the tab; member files are not automatically extracted into folders.
Members are deflated again; original stored sizes and compression settings are not reproduced.
Processed on your device. Files aren’t sent anywhere.
Two layers in, one layer out
The gzip checksum covers its uncompressed stream. Once that stream has been decoded, the reader checks TAR headers and copies supported member payloads into a new ZIP. TAR itself adds no per-member payload checksum.
TAR bundles the files; gzip compresses that bundle. Converting to ZIP changes how the bundle is organised and compressed, rather than undoing two compression layers.
The container-versus-compression distinction
What each layer contributes
Neither input layer survives the conversion. The output carries its own compression settings and its own directory.
| Layer | On input | In the output |
|---|---|---|
| gzip stream | decompressed, checksum validated | discarded; no gzip layer in the ZIP |
| tar member headers | read for names and payload lengths | rewritten as ZIP entries |
| member payload bytes | preserved exactly | written again, deflated at your level |
| deflate level | not present in tar | chosen by you: 1, 6 or 9, default 6 |
| gzip header name and time | may exist in the stream | not preserved |
Names that do not survive the round trip
This reader accepts paths represented directly in USTAR fields. It rejects PAX and GNU extension records used by some producers for longer names or metadata. It cannot recover a name that the original producer already truncated.
Names that are neither ASCII nor valid UTF-8 are refused as well, along with symlinks, hardlinks, device entries, PAX or GNU extended headers, absolute or traversal paths and duplicate paths. Timestamps, permissions, owners, comments and extra fields are not preserved; names and payload bytes are.
Converting the release
One file at a time, up to 12 MiB, with the bounds enforced while the stream decompresses.
- At most 200 entries are read and each member is capped at 8 MiB.
- The gunzipped TAR stream, including headers and padding, must fit 32 MiB and the 60x input-to-expanded ratio. Member payload limits are checked as well.
- Members land in the new ZIP in tar order; sorted-by-name is there when the receiving side expects an alphabetical directory.
- The rebuilt ZIP may be larger or smaller than the .tar.gz. Gzip compresses a whole TAR stream, while ZIP compresses files individually; measure your actual release rather than assuming one wins.
- Cancellation stops the read mid-stream, so a wrong bundle can be abandoned.