Skip to content

feat(builtins): add zip/unzip commands #553

@chaliy

Description

@chaliy

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions