hatchzip README

The project's README from github.com/xevrion/hatchzip. As one markdown file: README.md.

HatchZip

Extract huge archives in place. The archive shrinks as your files hatch,
so you only need free space for the output, not for the output and the archive.

hatchzip.dev | Installation | Usage | Safety | How it works | Contributing

#10 Repository Of The Day on Trendshift #2 Rust Repository Of The Day on Trendshift

CI OpenSSF Scorecard MIT or Apache-2.0 licensed Linux, Windows and macOS

HatchZip extracts the last part of the archive, then cuts it off the archive file, so the disk never holds the archive and all the files at once

HatchZip is a free, open-source archive extractor for Windows, macOS and Linux, with a desktop app and a command line tool. It extracts ZIP, 7z, RAR, tar and split archives in place, for when there is not enough disk space to extract an archive next to itself, such as a large game download on a nearly full disk. Download it from hatchzip.dev.

A 180 GB game download that unpacks to 200 GB needs 380 GB of disk with WinRAR, 7-Zip or unzip, because the archive and everything extracted from it have to exist at the same time. HatchZip needs a little over 200 GB. It extracts the archive from the end and cuts each finished part off the archive file as it goes, so the space the archive gives back is reused for the next files.

It checks that the extraction will fit before it changes anything, keeps a safety margin of free space the whole way through, and can be stopped or crash at any moment and pick up where it left off. It reads ZIP, 7z, tar, .tar.gz, .tar.bz2, .tar.xz, .tar.zst, RAR volume sets and split archives.

Get it

[!IMPORTANT] HatchZip is only distributed from this repository's releases and its site, hatchzip.dev. Other sites using the name, such as hatchzip.com, are not affiliated with this project.

No coding needed. Download for Windows (Windows 10 and 11), or for macOS (Apple Silicon), macOS (Intel) and Linux.

  1. Run the installer. Windows may show "Windows protected your PC" because the Windows downloads are not code-signed yet: choose More info, then Run anyway. On a Mac the app is signed and notarized, so at most macOS asks once whether to open an app downloaded from the internet.
  2. Right-click the archive, choose HatchZip, then Extract here. On Windows 11 the menu is under Show more options. On macOS the entries are under Quick Actions, once the menu is turned on and the HatchZip actions are ticked once under Quick Actions, Customise… (macOS adds them turned off). To pick the destination folder first, choose Extract files… instead.
  3. Or open HatchZip from the Start menu, open the archive, and choose Extract.

HatchZip shows whether the files will fit before it changes anything. The archive is used up as the files come out, so when it finishes, only the extracted files are left.

Extract here puts an archive with one folder or one file at its top next to the archive. An archive with several files or folders at its top goes into a new folder named after it, so its files never mix with what is already there. The progress window closes when the extraction completes; to keep it open, clear Close the progress window when extraction completes in the app's settings.

To take only some files or folders out, select them in the app's contents list (Ctrl+click or Cmd+click adds a row, Shift+click a range, Space the row under the cursor), then choose Extract selected… and the destination folder. Only those are extracted, and the archive is always kept.

On Windows and macOS, rows can also be dragged from the contents list into a folder in Explorer or the Finder. Dragging a selected row takes the whole selection; any other row goes alone. The archive is kept, as with Extract selected…. On Windows the entries are extracted when they are dropped, into a temporary folder that Explorer copies from and that is removed when HatchZip closes; up to 1 GB can be dragged at once. On macOS the Finder has each entry written straight into the folder it was dropped in. Linux has no drag out yet.

To keep the archive when there is room for both, choose Extract here (keep archive) in the right-click menu. To always keep archives, as other extractors do, clear Remove the archive during extraction in the app's settings; every right-click entry then keeps the archive too. That is a normal extraction: the archive is not changed, and space is required for all extracted files.

Settings

Open them with File > Settings… (Ctrl+, or Cmd+, on macOS), or the gear at the top right of the window. Every change applies at once and is saved; the main window's own controls and the right-click menu's windows use the same settings.

The app is in English, Spanish, Hindi, Russian, Simplified Chinese, Swedish and Turkish. It follows the system language until another is chosen under Language.

Section Setting Default
General Language: the system's, or English, Spanish, Hindi, Russian, Simplified Chinese, Swedish or Turkish The system language
General Appearance: System, Light or Dark System
General After extracting: do nothing, or open the destination folder Do nothing
General Close the progress window when extraction completes, for the window the right-click menu opens On
Extraction Remove the archive during extraction On
Extraction Verify archive before extracting Off
Extraction Reserved space: free space left untouched on the destination drive, in GB 2 GB
Extraction Default destination: next to the archive, or always inside a chosen folder, each archive in a folder named after it. Extract here in the right-click menu still extracts next to the archive. A chosen folder that no longer exists, or is on a drive that is not connected, is not used: the archive is extracted next to itself Next to the archive
Extraction When a file already exists: ask, replace (as --replace), or skip (as --skip-existing) Ask
Integration Show in the Explorer context menu on Windows, Show in the Finder context menu on macOS, Show in the file manager's context menu on Linux: the right-click menu entries. macOS adds its Quick Actions turned off, so tick them once under Quick Actions, Customise… in Finder As installed
Advanced The settings file's location, and Reset all settings

The settings file is %APPDATA%\HatchZip\settings.json on Windows, ~/Library/Application Support/HatchZip/settings.json on macOS and ~/.config/hatchzip/settings.json on Linux. A missing or damaged file, or a value the app does not recognize, means the default for that setting.

When there is not enough disk space to extract

The same 200 MB of game data (21 files), packed by the real tools, extracted on a 220 MiB disk with about 50 MB free:

Archive unzip / 7-Zip HatchZip
ZIP, 180 MB unzip ran out of space at file 6 of 21 Finished, every file byte-identical
7z from 7-Zip 25.01, -ms=20m (10 solid blocks) Needs 380 MB Finished in 0.64 s, every file byte-identical
7z split into 5 volumes of 40 MB Needs 380 MB Finished; volumes deleted one at a time, peak 210 MB used
tar from GNU tar, 200 MB Needs 400 MB Finished in 0.12 s, every file byte-identical
7z from 7-Zip with default settings (1 solid block) Needs 380 MB Refused before touching anything: one solid block can't be freed until all of it is out, so it needs 200 MB free
Result
ZIP extraction speed, same data 0.25 to 0.35 s, against 1.48 to 1.50 s for unzip 6.00, including an fsync unzip skips
Crash safety Killed at both unsafe moments of a batch at many points of each format's run; every resume finished with identical output
Works on Any filesystem that can shrink a file: ext4, btrfs, XFS, NTFS, APFS, and also exFAT and FAT32 USB drives

Measured on Fedora 43, Intel Core i7-14700HX, SK Hynix NVMe SSD, warm page cache; the disk-space runs used a 220 MiB tmpfs to stand in for a full laptop disk, the speed runs ext4. Speed comes from decompressing files in parallel, so an archive holding one giant file extracts at the speed of a single core.

The extra space HatchZip needs beyond the output is about the size of the largest single unit it can free at once: one file for ZIP and tar, one solid block for 7z. On filesystems that can punch holes (ext4, XFS, btrfs, tmpfs, NTFS and APFS), a large file stored or deflated in a ZIP, or in a tar, frees its archive bytes every 256 MiB while it is extracted: a ZIP holding one 600 MiB stored file extracted on a 950 MiB tmpfs with 367 MB free, where it needed 629 MB before. hatchzip check computes the exact figure for any archive.

Installation

Desktop app

Download from the latest release:

System File
Windows 10 and 11 (x64) HatchZip-x64-setup.exe: installs per user, no admin rights, adds the right-click menu
Windows 10 and 11 (x64), MSI HatchZip-x64.msi: the same app and install as the setup, as a Windows Installer package for deployment tools and msiexec /i HatchZip-x64.msi /qn. Install one or the other
Windows 10 and 11 (x64), portable HatchZip-x64-portable.zip: the same app and command line tool with nothing to install. Unzip it anywhere and run hatchzip-gui.exe; Settings > Integration, "Show in the Explorer context menu" adds the right-click entries for that location
macOS, Apple Silicon HatchZip-aarch64.dmg
macOS, Intel HatchZip-x86_64.dmg
Debian, Ubuntu (x64) hatchzip_amd64.deb: install with sudo apt install ./hatchzip_amd64.deb
Debian, Ubuntu (ARM64) hatchzip_arm64.deb: install with sudo apt install ./hatchzip_arm64.deb
Fedora, openSUSE hatchzip-x86_64.rpm
Any Linux HatchZip-x86_64.AppImage

The installers also put the hatchzip command (and its short name hz) on your PATH. From 0.1.12 the macOS app, the dmg and the command line tool are signed with a Developer ID and notarized by Apple, so they open without a warning beyond the usual question about an app downloaded from the internet (macOS 11 or later). The first update from an earlier build may ask once more for access to protected folders, because the signature changed. The Windows installers are not code-signed yet: choose More info, then Run anyway.

Right-click menu on macOS

The macOS app adds its Finder entries when asked: move HatchZip to Applications, open it, and turn on Show in the Finder context menu in the Settings menu. The setting refuses while HatchZip runs from the disk image or from the temporary copy macOS makes of an app that was never moved, since the entries would stop working once that copy is gone. Right-click or Control-click an archive in Finder, then choose Quick Actions to find HatchZip: Extract here, HatchZip: Extract here (keep archive), HatchZip: Extract files…, HatchZip: Extract to a new folder and HatchZip: Test archive. macOS adds these turned off, and HatchZip leaves that system setting alone. Turn them on once: right-click an archive in Finder, choose Quick Actions, then Customise…, and tick the HatchZip actions.

The entries are Quick Action workflows in ~/Library/Services, one per entry. They open HatchZip by its bundle identifier, so they keep working after the app is moved or updated. Turning the setting off, or running /Applications/HatchZip.app/Contents/MacOS/hatchzip-gui --unregister-shell, removes them, and so does brew uninstall --cask hatchzip. Before deleting the app by hand, turn the setting off; entries left behind can be removed by deleting ~/Library/Services/hatchzip-*.workflow.

If the entries do not appear, check that they are turned on:

Services can also be turned off in System Settings (System Preferences on macOS 11 and 12), Keyboard, Keyboard Shortcuts, Services, Files and Folders.

Command line only

Linux and macOS:

curl -fsSL https://raw.githubusercontent.com/xevrion/hatchzip/main/install.sh | sh

Windows, in PowerShell:

irm https://raw.githubusercontent.com/xevrion/hatchzip/main/install.ps1 | iex

Both download the build for your machine from the latest release, check it against its published SHA-256 checksum, and install hatchzip and hz for your user only, with the man page and shell completions. No root or administrator rights.

Every release file from 0.1.3 on carries signed build provenance. To check that a download really was built from this repository by its release workflow, wherever you got it:

gh attestation verify HatchZip-x64-setup.exe --repo xevrion/hatchzip

Package managers

Homebrew, Scoop and Chocolatey are live. winget is in review, and the AUR packages are coming soon; until they are listed as live here, a package under those names does not come from this project.

System Command Installs
Arch Linux (AUR) Not published yet. Until then, use the AppImage or the install script App and CLI
Windows (winget) In review; until it is accepted, use the setup App and CLI, same as the setup
Linux and macOS (Nix) nix run github:xevrion/hatchzip (add #hatchzip-rar for RAR) CLI
Linux, macOS and Windows (pip) pipx install hatchzip CLI, with RAR
Windows (Chocolatey) choco install hatchzip App and CLI, same as the setup
Windows (Scoop) scoop bucket add xevrion https://github.com/xevrion/scoop-bucket, then scoop install xevrion/hatchzip CLI
macOS and Linux (Homebrew) brew install xevrion/tap/hatchzip CLI
macOS (Homebrew) brew install --cask xevrion/tap/hatchzip App and CLI

With Cargo

cargo install hatchzip

This builds the command line tool from crates.io. The engine is a library too: hatchzip-core. It reads every format but RAR; cargo install hatchzip --features rar adds RAR support, which compiles UnRAR's C++ source under its own license and needs a C++ compiler.

With cargo-binstall, cargo binstall hatchzip downloads the release build for your system instead of compiling it, with RAR support, on Linux, macOS and Windows (x64; Arm on Linux and macOS).

With pip

pipx install hatchzip

This installs the command line tool from PyPI, with RAR support, on Linux (x64 and Arm, glibc and musl), macOS and Windows (x64). uv tool install hatchzip and pip install hatchzip in a virtual environment work too. The package holds the program itself, built from the same source with the same features as the other downloads, and runs no Python code.

With Nix

Run HatchZip directly:

nix run github:xevrion/hatchzip

Or install it into your profile:

nix profile install github:xevrion/hatchzip

The default package does not include RAR support. To enable it use the hatchzip-rar variant, which includes UnRAR under its own license.

Run it with:

nix run github:xevrion/hatchzip#hatchzip-rar

You can also install it into your profile:

nix profile install github:xevrion/hatchzip#hatchzip-rar

From source

With Rust (the version is pinned in rust-toolchain.toml and installed automatically):

git clone https://github.com/xevrion/hatchzip.git
cd hatchzip
cargo build --release

The binaries are target/release/hatchzip and target/release/hatchzip-gui (.exe on Windows). Building the desktop app on Linux needs the fontconfig headers (libfontconfig1-dev or fontconfig-devel). cargo build --release --features rar adds RAR support, as in the release builds; it needs a C++ compiler.

Shell completions and man page

hatchzip completions bash > ~/.local/share/bash-completion/completions/hatchzip
hatchzip completions zsh > "${fpath[1]}/_hatchzip"
hatchzip completions fish > ~/.config/fish/completions/hatchzip.fish
hatchzip completions powershell >> $PROFILE

hatchzip man > ~/.local/share/man/man1/hatchzip.1    # then: man hatchzip

Usage

See whether it fits

hatchzip check game.zip
game.zip  180.2 MB zip, 200.0 MB uncompressed in 22 entries
  available                    50.5 MB
  standard extraction needs    200.0 MB
  required                     29.9 MB (+5.0 MB reserved)
  available after              30.6 MB

check reads the archive's index and the disk's free space and changes nothing. "Standard extraction needs" is what extracting while keeping the archive requires; when that fits too, check says so. hatchzip check game.zip --keep-archive shows the plan for keeping it. For a 7z archive with a solid block of 512 MiB of output or more, check adds a note on whether the block holds restart points, places where decoding could begin with nothing saved. The block is released only after it is fully extracted either way. Finding them means reading the block, so check spends at most one second per archive on it and, when that is not enough for the whole block, says how far it searched and reports what it found as "at least". With --keep-archive the blocks are not searched and there is no note.

Extract

hatchzip extract game.zip                 # into ./game/
hatchzip extract game.zip -o D:\Games\Foo # somewhere else
hatchzip x game.7z.001                    # split archive; any part's name works
hatchzip x game.z01                       # split ZIP (game.z01, ..., game.zip); any part works

HatchZip prints the same space plan, asks for confirmation, then extracts. When the extraction is complete, the archive has been removed and the files are in the output folder. For a split archive, each volume is deleted as soon as everything in it is extracted.

Option Effect
-o, --output <dir> Output folder. Defaults to a folder named after the archive, next to it. It may hold other files, but none where the archive's files go, unless --replace is given.
--keep-archive Keep the archive: a normal extraction that removes nothing. Space is required for all extracted files. No confirmation is asked.
--only <path> Extract only this entry, or everything in this folder, and keep the archive. Repeat it for several. See Extract some entries.
--replace Replace files that already exist in the output folder. See Extract over existing files.
--skip-existing Keep files that already exist in the output folder instead of the archive's copies.
--keep-free <size> Free space HatchZip never uses, such as 500MB or 10GB. Default 2GB, so the disk never fills to zero.
--verify-first Read the whole archive and check every file's checksum before deleting anything. Takes extra time, recommended for downloads you can't easily get again.
--skip-damaged Go past damaged entries instead of stopping: what decodes of each is saved as NAME.damaged, and its data is then removed from the archive like the rest. Never applied unasked. See Damaged entries.
-y, --yes Skip the confirmation prompt. Required when not run from a terminal, unless --keep-archive is given.
--nested After extracting, also extract the archives among the files it wrote, one level deep. See Archives inside an archive.
-q, --quiet Print only errors and prompts.

Keep the archive

hatchzip extract game.zip --keep-archive

When the disk has room for the archive and all its files, --keep-archive extracts like any other tool and leaves the archive byte for byte as it was, for when it is needed again. The space check, path and collision checks, checksums and password handling are the same as for an extraction in place. If keeping the archive does not fit, HatchZip says so, by how much, and what extracting in place would require instead.

An interrupted run resumes like any other, and goes on keeping the archive even when resumed without --keep-archive. An extraction that started in place cannot switch to keeping the archive, since part of it is already removed. hatchzip restore on an archive being kept only discards the progress: the archive was never changed.

Damaged entries

An entry whose data does not decode stops the extraction where it is: the entries after it in the archive are out, that entry and everything before it are still in the archive, and the progress is saved. One failed decoding does not show that the archive is damaged there, so the message says to run the same command again: if it stops at the same entry, the entry is damaged in the archive. From there, hatchzip restore turns what is left back into an archive other programs can open, the damaged entry included. The one case where it cannot is a large entry that was being extracted while its archive bytes were freed behind it: part of it is out and its archive data released, restore refuses that state, and the ways on are --skip-damaged or leaving everything as it is.

hatchzip extract game.zip --skip-damaged

With --skip-damaged the extraction goes on instead. What decoded of a damaged entry is saved as NAME.damaged, never under the entry's own name and never over an existing file, and every other entry is extracted as usual. The run ends with a list of every damaged entry and how many of its bytes were saved, leaves the same list in the output folder as hatchzip-damaged-entries.txt, and exits with status 6:

2 entries are damaged in the archive and were not extracted whole:
  game/data/deflated.bin: 196548 of 400000 bytes saved as game/data/deflated.bin.damaged (its data could not be decoded past that point)
  game/data/stored.bin: all 200000 bytes saved as game/data/stored.bin.damaged (the data does not match its checksum, so part of it is wrong)
Their data was removed from the archive with the rest, so the .damaged files are all that is left of them.
This list is saved in out/hatchzip-damaged-entries.txt.

This cannot be undone. Extracting in place removes a damaged entry's data from the archive like every other entry's, so afterwards no other program can try to read it, and restore cannot bring it back. So the flag is never applied unasked, it is part of the confirmation, and an interrupted extraction goes past damage only when the flag is given again. With --keep-archive nothing is removed from the archive, so nothing is lost by it. A .damaged file holds what decoded and nothing more: a file that fails its checksum has wrong bytes somewhere in it, and one that stopped decoding ends shortly before the point where its data stops decoding: less than a kilobyte before it, or up to a megabyte for a large entry that was extracted while its archive bytes were freed. It is read back before its entry is removed from the archive, like every file a run writes.

A solid 7z block is one stream that decodes only in order, and the rule there has two halves:

Before an entry is given up on, its unit is decoded a second time, and it has to fail at the same entry, in the same way, at the same byte. That rules out a fault that does not repeat on a second read. It does not rule out one that does: the second pass reads through the operating system's cache, so a misread kept there is read again, and a failing drive can return the same wrong bytes every time. A large entry that was being extracted while its archive bytes were freed can only be decoded again from its last resume point, and its line in the list says from which byte. While going past damage, each solid block is decoded on one thread, which is slower for LZMA2 blocks that could use several: extracting a 287 MB solid LZMA2 7z in place with a release build took 6.85 to 7.07 s with the flag and 3.24 to 3.46 s without it, about 2.1 times as long. A 222 MB ZIP showed no measurable difference.

What it covers:

Archive With --skip-damaged
ZIP entries that are stored or deflated, also in split and self-extracting archives Each damaged entry is saved, every other one extracted
7z, one file to a block, stored or in LZMA, LZMA2, bzip2, Deflate or PPMd, with or without a BCJ or Delta filter The same
7z solid blocks in those methods A file that only fails its checksum is saved whole and the rest of the block is extracted. A decoder failure loses the files after it in that block
tar Accepted, but a tar has no checksums, so damage in a file is not detected with or without it
.tar.gz, .tar.bz2, .tar.xz, .tar.zst Refused: the stream is checked whole before anything is extracted, so damage stops the run with the archive untouched
RAR and encrypted archives Refused
Together with --replace or --skip-existing Refused: the flags cannot be combined

A ZIP entry in another method (bzip2, zstd, LZMA and so on) and a 7z block in Zstandard, Brotli or LZ4 are never taken for damaged, and stop the run as before: those decoders can refuse valid data, which reads the same. Neither is a decoder that ran out of memory, or a read the system failed. Nor is a decoder failure in the read that would hand out the last bytes of an entry, or one after the last entry of a 7z block is out, such as in the end marker of its stream: the LZMA2 decoder reports a damaged end of its data in place of bytes it already decoded, so the entry may be whole, and 7-Zip then writes it whole. The run stops there as without the flag, with nothing removed. Damage to the archive's index or headers is refused before anything is extracted, with or without the flag, and a volume that goes missing during a run stops it as a failed read. With --verify-first, the damage is listed before the confirmation and before anything is removed. An archive that holds an entry named hatchzip-damaged-entries.txt, or an entry named like another one plus .damaged, refuses the flag. The desktop app has no setting for it, and does not continue an extraction that was run with it: such an extraction is completed from the command line.

Extract some entries

hatchzip list game.zip
hatchzip extract game.zip --only docs --only bin/tool.exe

--only takes a path as list shows it: a file, or a folder with everything inside it. Only those entries are extracted, with the folders above them; nothing else is written. --only implies --keep-archive, since the entries left out stay in the archive, so the archive is left byte for byte as it was and the space check counts only the selected files. A path that is not in the archive is refused before anything is written.

A hard link brings its target along, since the link is made from the extracted target. A symbolic link is extracted as it is, even when what it points to is left out. An interrupted run resumes with the same entries, with or without --only; resuming with entries that are not part of the selection is refused. It takes one archive at a time.

Extract over existing files

hatchzip extract patch.zip -o "D:\Games\Foo" --replace

HatchZip does not overwrite files. When a file the archive contains already exists in the output folder, extraction is refused before anything is changed, unless --replace or --skip-existing is given, as for a game patch or a mod extracted over an installed game. In the desktop app, HatchZip asks about each file instead: Replace, Skip, which keeps the existing file, or Keep both, which adds the archive's copy beside it as name (2).ext, with an option to do the same for the rest.

When the archive is removed during extraction, a skipped file's copy in the archive is not kept: it is extracted, then discarded, and the existing file stays.

With --replace, before anything is extracted, every existing file or link at the path of a file in the archive is moved into a .hatchzip-replaced folder inside the output folder, keeping its relative path. The move is a rename on the same disk, so it needs no extra space and no data is copied; a link is moved, never followed. The replaced files are deleted when the extraction completes, and the ones to keep are moved back. The space plan is unchanged: the replaced files keep their space until the end.

Several archives

hatchzip extract a.zip b.7z c.tar.gz

The archives are extracted one after another, each into its own folder, or all into the folder given with -o. The space for each one is checked just before it starts, so the space one archive frees is available to the next. The first archive that does not complete stops the run, and HatchZip lists which archives were extracted, which one stopped and whether its progress is saved, and which were not started; the exit status is that archive's. check, test and list also take several archives, go through all of them, and exit with the status of the first one that did not succeed. Naming every volume of a split archive, as a shell pattern like game.7z.* does, counts as that archive once.

Archives inside an archive

hatchzip extract bundle.zip --nested

With --nested, once the archives given are extracted, HatchZip looks among the files they wrote for archives and extracts those too, each into its own folder next to it. A file counts as an archive only when its name has an archive extension and its contents start with that format's signature, so a .jar or a .docx is left alone. It goes one level deep: archives inside those are not looked for. A split set counts once, by its first volume. Only files the run wrote are considered, never files that were already in the output folder.

HatchZip lists the archives it found and asks once before extracting them, since each one is removed during its extraction; --yes skips the question. With --keep-archive, they are kept too and nothing is asked. As with several archives, the first one that does not complete stops the run. The desktop app does not have this option.

From a URL

HatchZip itself never touches the network. To extract an archive straight from a URL, HatchZip Link is a separate tool built on the same engine: it checks whether the archive fits before downloading it, resumes an interrupted download, verifies it, then extracts it in place.

cargo install hatchzip-link
hatchzip-link --check https://example.com/dataset.zip -o data
hatchzip-link https://example.com/dataset.zip -o data

Stop and resume

Press Ctrl+C and HatchZip finishes the files it is writing, saves its progress and exits. A second Ctrl+C quits immediately, which is also safe. To continue, run the same command again:

hatchzip extract game.zip

The same applies after a crash, a power cut, or running out of space because something else filled the disk. Progress lives in small files next to the archive: game.zip.hatchzip and game.zip.hatchzip-tail, and game.zip.hatchzip-folders when the archive's folders have permissions or times to set. Do not delete them while an extraction is unfinished: they hold the archive's index, which is no longer inside the archive itself.

Anyone who supplies an archive could also supply progress files next to it, so HatchZip follows them only to the archive's own files, and only for an extraction started on this computer. Every extraction notes its output folder in your user profile, outside the archive's folder, so a resume on the same computer needs no options, and progress files without that note are refused. That includes an extraction HatchZip 0.1.5 or earlier started in the default folder, before the note existed, and one started on another computer: delete its progress files if you did not start it, or finish it with the release or computer that started it. An archive that holds files named like progress files is refused.

Stop for good

To give up on an unfinished extraction instead, restore the archive:

hatchzip restore game.zip

What is left of the archive becomes a normal archive again, holding exactly the entries not yet extracted, which 7-Zip, WinRAR, unzip or tar open as usual. The files already extracted stay in the output folder. Restore only appends a new index, so it needs only the free space that index takes, and if it is interrupted, running it again finishes it.

List and test

hatchzip list game.7z    # what's inside, with sizes
hatchzip test game.7z    # read every file and verify its checksum, writing nothing

Plain tar has no checksums for file contents, so test on a tar only proves every file can be read in full.

Pack a folder into a ZIP

pack writes a new ZIP from a folder and keeps the folder unchanged, so free space is required for the whole archive. An archive on the same disk as its files is not a backup. Packing in place, removing each file once it is safely in the archive, is planned and not part of this release, so every run needs --keep-source; plain pack is kept free for that.

hatchzip pack old-site --keep-source --check            # what would be packed, and the space it needs
hatchzip pack old-site --keep-source -o old-site.zip    # pack it; old-site is kept unchanged
hatchzip pack old-site --keep-source --store            # store files without compressing them
hatchzip pack old-site --keep-source --level 9          # deflate level, 1 (fastest) to 9 (smallest)

Every file, folder (empty ones included) and symbolic link inside the folder becomes an entry, with its path relative to the folder, its modification time and its Unix permissions. Files are compressed with deflate at level 6 unless --store or --level is given, and a file deflate would make larger is stored. ZIP64 is used where a file, the archive or the number of entries needs it. Without -o, the archive is the folder's name plus .zip, next to the folder. Before the archive gets its name, it is read back with the reader extraction uses, and every entry must come back at the path it was packed from, so HatchZip extracts the result in place like any other ZIP. 7-Zip, Info-ZIP unzip, bsdtar, macOS ditto and Python's zipfile read it too, ZIP64 included; Windows Explorer has not been tried yet.

The archive is written as old-site.zip.hatchzip-pack-part, locked, flushed to disk, its index read back, and only then renamed to old-site.zip with a rename that never replaces a file, so an interrupted run or a crash never leaves a partial archive under the name given. The next run removes the leftover file, if it is empty or starts as a ZIP does and no other run holds it; any other file at that name is left alone and the run refused. An existing file is never overwritten. Ctrl+C stops the run and removes the partial archive.

Refused before anything is written:

A symbolic link is stored as a link and never followed. Links whose targets are outside the folder, such as /etc/hosts or ../../elsewhere, are stored as they are and listed, since the archive does not hold what they point to. Hard links are packed as separate files.

--check lists the counts, the free space, and the most space the archive can take, which is the files' total size plus headers, since files that are already compressed don't shrink (at level 1, up to an eighth more, the most its fast encoder can grow incompressible data). It writes nothing, and exits with status 3 when that most does not fit.

Machine-readable output (JSON)

The list and check commands support --json for scripts and other tools:

hatchzip list game.zip --json
hatchzip check game.zip --json

Both commands emit one JSON document on stdout, using the same top-level envelope. The following is an example of a successful list --json result. A check --json result uses space_plan instead of entries:

{
  "version": 1,
  "archives": [
    {
      "archive_path": "game.zip",
      "state": "fresh",
      "format": "zip",
      "archive_size_bytes": 123456,
      "entry_count": 1,
      "remaining_uncompressed_size_bytes": 4096,
      "entries": [
        {
          "path": "readme.txt",
          "kind": "file",
          "size_bytes": 4096,
          "mode": null,
          "modified_at": null,
          "encrypted": false,
          "hard_link_target": null
        }
      ],
      "error": null
    }
  ]
}

version identifies the JSON schema. archives contains one result for each distinct archive, in input order. A split archive appears once, with archive_path naming its first volume.

The archive metadata fields are:

Field Meaning
archive_path Archive path, or the first volume of a split archive
state fresh or resuming; null when the archive could not be opened
format Archive format, or null when unavailable
archive_size_bytes Original archive size in bytes; null when resuming or unavailable
entry_count Number of entries still to extract
remaining_uncompressed_size_bytes Uncompressed size still to extract, in bytes

The format field can be zip, split-zip, 7z, tar, tar.gz, tar.bz2, tar.xz, tar.zst, or rar when RAR support is enabled.

Fields that are unavailable are present as null, rather than omitted. For a resumed archive, entry_count and remaining_uncompressed_size_bytes describe only the entries and data still to extract. The original archive size is not reported because parts may already have been removed.

list --json adds an entries array. Each entry has:

Field Meaning
path Safe archive member path, using / separators
kind file, directory, symlink or hard_link
size_bytes The size recorded by HatchZip's archive model, in bytes
mode The mode as the archive stores it, as an integer, or null when unavailable. ZIP usually includes the file-type bits (33188 for a plain file); tar usually stores only the permission bits (420)
modified_at Modification time in RFC 3339 UTC, or null
encrypted Whether the entry is encrypted
hard_link_target Target path for a hard link, otherwise null

Paths containing invalid UTF-8 are represented using U+FFFD, the Unicode replacement character, matching the paths HatchZip extracts.

size_bytes reports the archive model's value without estimating or recalculating it. Its meaning can depend on the format and entry type. TAR and RAR directory entries have a size of zero. TAR symbolic links use the byte length of their target path. TAR hard links use the target file's size when it can be found, otherwise zero. ZIP and 7z report the size supplied by their respective archive readers.

check --json adds a space_plan object:

Field Meaning
needed_bytes Space required by the selected extraction mode
available_bytes Usable available space
reserved_bytes Space reserved by --keep-free
fits_in_place Whether extraction fits while removing the archive
fits_with_archive_kept Whether extraction fits while keeping the archive
in_place_refusal_reason Why in-place extraction is unavailable, or null

A fit field is null when that extraction mode cannot be selected. For example, a resumed extraction must continue in the mode recorded in its journal, so the alternative mode is null. An orphaned archive has no remaining space plan and reports space_plan: null.

When in-place extraction is refused, check --json exits with code 1, sets in_place_refusal_reason, and leaves the archive result's error field as null. The archive can still be extracted with --keep-archive when that mode is supported.

For a partially extracted archive, check --json has a damaged_entries list: the entries an earlier run went past with --skip-damaged, empty when there are none. It is null for an archive nothing was extracted from and for one that could not be read. Each object has path, size_bytes, saved_bytes, saved_path (the path plus .damaged, relative to the output folder, or null when nothing was saved) and reason: checksum (every byte decoded, the checksum does not match), decode (decoding stopped partway) or after_damage (it follows data that could not be decoded in the same solid block), and reread_from_byte: 0 when the whole entry was decoded a second time, otherwise the byte of the entry from which it was, for an entry whose archive bytes before that were already freed.

check --json also has a solid_blocks list, with one object for every 7z solid block of 512 MiB of output or more, in archive order. It is empty for every other archive. It is null whenever space_plan is null, and with --keep-archive (or when resuming a run that keeps the archive), where the blocks are not searched: a kept archive is never released, so the list has no bearing on it. It describes the archive only: a solid block is released once it is fully extracted, whatever the list says.

Searching a block means reading its packed data from the start, so check spends at most one second per archive on it. A block it could not finish in that time is reported as searched in part: restart_points_complete is false, and restart_points counts only the part that was searched. Whether the search finishes depends on the block's size and on how fast the disk reads it, so the same archive can give a complete answer on one run and a partial one on another.

Field Meaning
packed_size_bytes The block's size in the archive
uncompressed_size_bytes The size of the files the block holds
method The block's compression methods, such as LZMA2 or BCJ_X86 LZMA2
restart_points Places inside the block where decoding could begin with nothing saved: LZMA2 chunks that reset the dictionary. null when the block was not searched. When restart_points_complete is true, all the block has (0 when it has none). When it is false, the ones in the part that was searched: the block has at least that many
restart_points_complete true when the search reached the block's end, false when it stopped at the time limit, null when the block was not searched
searched_uncompressed_size_bytes How much of the block's output the search covered, counted from the block's start: uncompressed_size_bytes when the search is complete, less (down to 0) when it is not, null when the block was not searched
max_restart_spacing_bytes The most output between two neighbouring restart points, counting the block's start and end. null when there are no restart points, and whenever restart_points_complete is not true: the widest gap may lie in the part that was not searched
no_restart_points_reason null when restart points were found. Otherwise no_dictionary_resets (LZMA2 written in one piece), lzma, filter, bcj2, encrypted, other_method, invalid_chunks, too_many_chunks, read_error or time_limit (the search stopped at the time limit before it found one, which does not mean the block has none); see the format notes

Each archive result has an error field containing an error message or null. If one archive in a multi-archive command cannot be read, the other results are still emitted. The command continues through the inputs and exits with the status of the first archive that did not succeed.

JSON output is written only to stdout. Progress messages and errors are written to stderr. Existing exit codes are preserved, including exit code 3 for insufficient disk space.

Exit status

Code Meaning
0 Success
1 Failure. If extraction had started, progress is saved.
2 Invalid command line
3 Not enough free space. Nothing was changed.
4 The archive is damaged. Nothing was deleted.
5 The archive is password protected and no correct password was given.
6 The extraction completed, but with --skip-damaged it went past damaged entries, which are listed, on screen and in hatchzip-damaged-entries.txt in the output folder, and were not extracted whole.
130 Paused with Ctrl+C. Run the same command to continue.

With several archives, the status is that of the first archive that did not succeed.

Using HatchZip from AI agents

skills/hatchzip/SKILL.md is an agent skill for Claude Code and other agents that read the Agent Skills format. It tells an agent to reach for HatchZip when an archive won't fit, to run hatchzip check --json first, to keep the archive when there is room, and to ask you before extracting in place, since that removes the archive. To install it in Claude Code, as a plugin that updates with HatchZip:

/plugin install hatchzip --marketplace xevrion/hatchzip

On Claude Code before 2.1.275, run /plugin marketplace add xevrion/hatchzip, then /plugin install hatchzip@hatchzip. To copy the skill by hand instead, or for another agent that reads skills from a folder:

mkdir -p ~/.claude/skills/hatchzip
curl -fsSL https://raw.githubusercontent.com/xevrion/hatchzip/main/skills/hatchzip/SKILL.md -o ~/.claude/skills/hatchzip/SKILL.md

The skill only tells the agent how to use HatchZip; the agent still needs the hatchzip command (see Installation) and asks for it if it's missing.

Is HatchZip safe

HatchZip destroys the archive as it extracts, so it is built around never losing a file that has not safely landed on disk.

What it cannot protect against: if the download itself is damaged, the files before the damaged spot are extracted and the archive is partly gone. Use --verify-first when the archive can't be downloaded again and has no .sfv file. A run that stopped at damage can be turned back into an archive with restore (unless it stopped inside a large entry whose archive bytes were already being freed), or taken past the damage with --skip-damaged, which saves what decodes of the damaged files and then removes their data from the archive with the rest. On btrfs or APFS, space held by a snapshot that includes the archive is not freed until the snapshot is deleted.

Antivirus warnings

HatchZip does not connect to the network. It has no networking code and no networking library, and CI fails if an HTTP, TLS or socket crate enters the dependency tree (deny.toml). It collects nothing and sends nothing.

The Windows release files are not code-signed yet, and some antivirus engines that score files by machine learning or behaviour flag new, unsigned programs. From 0.1.12 the macOS downloads are signed with a Developer ID and notarized by Apple. On VirusTotal, the v0.1.3 Windows setup is flagged by 4 of 70 engines, all heuristic or machine-learning scores; Microsoft Defender reports it clean. What sandboxes list is what any installer does: it writes program files, adds the right-click menu and "Open with" entries, and runs Inno Setup's helper process. Windows code signing is planned through the SignPath Foundation.

To check that a download is genuine, compare its SHA-256 with the .sha256 file next to it, or verify that this repository's release workflow built it:

gh attestation verify HatchZip-x64-setup.exe --repo xevrion/hatchzip

Verify your download has the commands for every system and the checksum of every release file, each with its VirusTotal report. Or build it yourself: cargo install hatchzip.

Supported formats

Format Status Freed in steps of
ZIP, ZIP64, self-extracting .exe ZIPs Supported. Tested: Stored, Deflate, Deflate64, bzip2, LZMA, PPMd, XZ and Zstandard, including archives made by 7-Zip itself, and entries past the 4 GiB mark. One file
7z, solid and non-solid Supported. Tested with archives made by 7-Zip 25.01: LZMA2 (its default), LZMA, BCJ with LZMA2, bzip2, Deflate and PPMd; Zstandard with an archive made by py7zr, since 7-Zip has no Zstandard coder for the 7z format; and LZ4 and Brotli with archives made by 7-Zip ZS 25.01, the 7-Zip build that adds those coders. A coder this build has no decoder for is refused before anything is touched. One solid block
tar (uncompressed) Supported, including long names, symlinks and hard links One file
.tar.gz, .tgz Supported, including multi-member gzip (bgzip, pigz -i) and split .tar.gz.001 sets. Extracted from the front, freeing the compressed bytes behind the decoder where the filesystem can punch holes; every gzip CRC-32 and length is checked before anything is touched. Tested with archives from GNU tar with gzip, and pigz. Elsewhere (FAT32, exFAT) it still extracts and resumes, but needs room for the archive and every file at once, and check says so. 256 MiB of output
.tar.bz2, .tbz2, .tbz Supported, including concatenated bzip2 streams and split .tar.bz2.001 sets. Extracted from the front, freeing bytes at CRC-checked block boundaries where hole punching is available. Every block and combined stream CRC is checked before anything is touched. Damage and a bare bzip2 file without a tar are refused before extraction. On FAT32 and exFAT it needs room for the archive and every file at once. 256 MiB of output
.tar.xz Supported when the xz stream holds more than one block, which is xz's multithreaded default and what xz -T4 -6 --block-size=8MiB writes. Each block is decoded on its own and its CRC-32 or CRC-64 checked; an LZMA2 dictionary is not carried between blocks, so a point needs no window. A one-block archive (xz -T1) is refused in place, since nothing can be freed while it decodes, and extracts with --keep-archive. Refused before anything is touched: SHA-256 or unknown checks, unknown filters, concatenated xz streams, and dictionaries over 1 GiB. A stream with no checks (--check=none) is refused in place, since damage inside it could not be caught before the bytes are freed, and extracts with --keep-archive. 256 MiB of output
.tar.zst, .tzst Supported when the zstd stream holds more than one frame, as pzstd and concatenated files write. Each frame is independent and decoded on its own, with its XXH64 checksum verified before the frame behind it is freed, so a point needs no window. Skippable frames are skipped, including the one pzstd writes before every frame and the seekable format's table. The zstd CLI writes one frame even with -T0, so most .tar.zst files are refused in place and extract with --keep-archive. Refused before anything is touched: frames that name a dictionary, and windows over 1 GiB (--long=31). A stream whose frames carry no checksum is refused in place, since damage inside it could not be caught before the bytes are freed, and extracts with --keep-archive. On FAT32 and exFAT it needs room for the archive and every file at once. 256 MiB of output
Split archives (.001, .002, ...) of ZIP or 7z, as 7-Zip makes them Supported One file or block; each volume is deleted once emptied
Password-protected ZIP (ZipCrypto and AES) and 7z (AES, including encrypted file lists) Supported. HatchZip asks for the password, or takes --password or HATCHZIP_PASSWORD, and proves it on one file before anything is deleted. It is never saved, so a resumed run asks again. Same as unencrypted
One huge solid 7z block Works, but needs free space for the whole block, as the table above shows. Freeing space inside a block is the same planned technique.
RAR, RAR 5 and RAR 4, single files and volume sets (.part1.rar, .part2.rar, ... or .rar, .r00, ...) Supported in the release builds, decoded by UnRAR (see License); builds without the rar feature, such as cargo install hatchzip, refuse RAR before anything is touched. Password-protected files work as for ZIP: a RAR 5 password is proven by its check value, a RAR 4 one by decoding the smallest encrypted file, which for a large file can take a while. Archives with encrypted file names ("Encrypt file names", rar -hp) need the password even to be listed, and are freed file by file like any other. A large stored file is freed while it is written, as in tar. Refused before anything is touched: links, dictionaries over 4 GB, and sets with a volume missing or a stray one after the last. restore works, except for archives with encrypted file names, since it takes no password; such an extraction can only be completed. Tested with archives made by RAR 6.24 (RAR 5 and RAR 4) and archives written by the test suite; sets made by WinRAR 7.23 were tested on Windows when RAR support was first written. One file; a volume once every file that reaches into it is out
Solid RAR Extracted only while the archive is kept (--keep-archive): a solid archive decodes front to back in one pass and UnRAR can't save its state, so it can't be freed as it goes or resumed mid-way. In place, it is refused before anything is touched.
Native split ZIP (.z01, .z02, ..., .zip), as Info-ZIP zip -s, WinZip and WinRAR write it Supported. HatchZip reads the index in the last part itself, maps every offset in it to its part, and hands the zip library the same index for the joined parts, so decoding, CRC checks, passwords (ZipCrypto and AES) and freeing space inside a large file work as for any ZIP. Any part's name opens the set, .zip included. Refused before anything is touched: a part missing, a stray part after the last, the last part on its own, an empty part, an index that points outside its parts, and a part whose entries disagree with the index, such as one from another copy of the archive. restore works; once the .zip is gone, it writes a new .zip holding only the index. Sets on removable media whose parts all have the same name are not handled. The test suite builds sets itself and, where Info-ZIP is installed, with zip -s; sets from WinZip and WinRAR are not tested. One file; a part once every file that reaches into it is out

How it works

ZIP, 7z and tar all store their contents as a sequence of independent pieces: files for ZIP and tar, solid blocks for 7z. ZIP and 7z keep their index at the very end. HatchZip saves that index to a side file, then extracts pieces starting from the last one in the archive. After each batch it truncates the archive to where that batch began, which every operating system and filesystem supports; for a split archive, that means deleting whole volumes and shortening one. RAR stores files one after another like tar, so it is freed file by file too, and a volume is deleted once every file reaching into it is out. A .tar.gz, .tar.bz2, .tar.xz or .tar.zst is one compressed stream that can only be decoded from the front, so HatchZip extracts it front to back and punches holes in the compressed bytes it has used, at resume points it can restart from after a crash. The full design, including the exact order of writes that makes a crash safe, is in How it works.

How it is built

HatchZip is written with the help of AI coding assistants, and AGENTS.md is the rulebook they work under. It is the strict part of the project: the tool deletes its own input, so a change only lands with proof.

Pull requests and bug reports from people are held to the same rules, and are very welcome.

Star history

Star history of xevrion/hatchzip

Sponsor HatchZip

HatchZip is free and open source, and it stays that way: no paywall, no ads and no sponsor logos in the app. Sponsorship pays for part-time maintenance (reviews, releases and support), an independent security review of the code that frees archive space, and new formats such as single-frame .tar.zst.

Sponsor through GitHub Sponsors, or see hatchzip.dev/sponsor.html for every option, including company sponsorship. SPONSORS.md has the sponsor policy and the list of sponsors.

License

HatchZip is licensed under either of Apache License, Version 2.0 or MIT license, at your option.

RAR archives are decoded by the UnRAR source code, which is freeware under its own license: free to use for extracting RAR archives, but not to build a RAR compatible archiver. It is compiled in only with the rar cargo feature, which is off by default, so cargo install hatchzip, the crates on crates.io and distribution builds are open source throughout and need no C++ compiler. The release builds on the releases page have it on, and every release download includes LICENSE-UNRAR.

Contributing

Bug reports, especially from filesystems and operating systems not covered by CI, are welcome. Read CONTRIBUTING.md first.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in HatchZip by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

hatchzip (xevrion/hatchzip)

zip
Searching Database…

What is this?HatchZip is a free, open-source archive extractor for ZIP, 7z, RAR, tar and split archives that extracts files 'in place', consuming the archive as it goes so you only need free space for the output, not for the archive and the output combined.
Is it a desktop app or a command-line tool?Both: there's a desktop app with a right-click 'Extract here' context menu for Windows, macOS and Linux, and a CLI (hatchzip, short alias hz) that also installs with it; the core engine is additionally available as a Rust library (hatchzip-core).
Do I need anything extra for RAR support?Reading RAR archives is not built in by default; you need 'cargo install hatchzip --features rar', which compiles UnRAR's C++ source and requires a C++ compiler.
Any install pitfalls I should expect?The Windows installer and macOS app aren't code-signed yet, so Windows shows a SmartScreen warning (choose More info, then Run anyway) and macOS requires approving the app once in Privacy & Security; also winget and AUR packages aren't officially listed as live yet, so packages under those names elsewhere aren't from this project.
Does it work on Intel Macs too, or only Apple Silicon?Both are supported, with separate dmg builds for each.
How much faster is HatchZip than unzip or 7-Zip?On the same ZIP data it extracted in 0.25-0.35s versus 1.48-1.50s for unzip 6.00, mainly because it decompresses files in parallel across cores.
What happens if extraction crashes halfway through?HatchZip is crash-safe: a file is flushed to disk and renamed into place before its bytes are cut from the archive, so a crash never loses a file, and you can resume by simply running the same command again.
Can I keep the original archive after extracting?Yes, use --keep-archive (or the 'Extract here (keep archive)' context menu option) for a normal extraction that leaves the archive untouched, provided there's enough disk space for both.
What if I want to cancel an extraction midway and restore the archive?Run 'hatchzip restore' to reconstitute a normal archive containing only the entries not yet extracted, which other tools like 7-Zip or WinRAR can open as usual.
Creator
xevrion
Size
7.8 MB
Stars
3.3K
Age
1mo
Commits · 90 Days