Summary
zip and unzip handle the most common archive format on the web. While tar/gzip are implemented, zip is the default format for GitHub releases, downloaded artifacts, and cross-platform file exchange.
Requested Flags
zip
| Flag |
Description |
| (default) |
Create zip archive |
-r |
Recurse into directories |
-j |
Junk (strip) directory paths |
-u |
Update existing archive (add changed files) |
-d |
Delete entries from archive |
-x pattern |
Exclude files matching pattern |
-9 / -0 |
Compression level (best / store only) |
unzip
| Flag |
Description |
| (default) |
Extract all files |
-l |
List archive contents |
-d dir |
Extract to directory |
-o |
Overwrite without prompting |
-j |
Junk paths (extract flat) |
-p |
Extract to stdout (pipe) |
file.zip pattern |
Extract only matching files |
Use Cases
# Create archive
zip -r project.zip src/ lib/ README.md
# Extract
unzip artifact.zip -d output/
# List contents
unzip -l release.zip
# Extract specific file
unzip data.zip "*.csv" -d data/
# Pipe content
unzip -p archive.zip config.json | jq .version
Implementation Notes
- Use
zip crate from crates.io for format handling
- Must operate on VFS (read/write virtual files)
- Validate paths in zip entries to prevent directory traversal (same as tar)
- Compression level support is nice-to-have; deflate default is sufficient
- Enforce VFS size limits when extracting
Summary
zipandunziphandle the most common archive format on the web. Whiletar/gzipare implemented, zip is the default format for GitHub releases, downloaded artifacts, and cross-platform file exchange.Requested Flags
zip
-r-j-u-d-x pattern-9/-0unzip
-l-d dir-o-j-pfile.zip patternUse Cases
Implementation Notes
zipcrate from crates.io for format handling