Skip to content

Mac Archive Utility fails on zip with empty directories #558

Closed

Description

@filiphoeven

When zipping a folder that contains empty folders using this code:

		const zipFile = fs.existsSync(filePath) ? new AdmZip(filePath) : new AdmZip();
		zipFile.addLocalFolder(folderPathToZip);
		zipFile.writeZip(filePath);

The ZIP file cannot be unzipped by Mac OS's "Archive Utility" app used by "Finder" to unzip ZIP files.
It works command line using the "zip" command and it works with "The Unarchiver" app.

It fails with "Error 79 - Inappropriate file type or format" in "Archive Utility".

  • "adm-zip": "0.5.10"
  • Mac OS Sequioa 15.5 (24F74)
  • zip --version
    Copyright (c) 1990-2008 Info-ZIP - Type 'zip "-L"' for software license.
    This is Zip 3.0 (July 5th 2008), by Info-ZIP, with modifications by Apple Inc.
    Compiled with gcc Apple LLVM 17.0.0 (clang-1700.0.13.5) [+internal-os] for Unix (Mac OS X) on Apr 18 2025.

Activity

  1. JohnJunior commented on Jun 17, 2026

    @JohnJunior
    Contributor

    I can reproduce this on my machine — and in my case Archive Utility didn't
    just throw "Error 79", it quit unexpectedly when opening a zip that
    contained an empty directory.

    Environment

    • MacBook Air (M3), macOS 26.5.1 (build 25F80)
    • adm-zip 0.5.17, Node v22.11.0

    Root cause: the method setter in headers/entryHeader.js is missing a
    break, so the switch falls through and sets "version needed to extract = 2.0"
    for all entries — including STORED ones (every directory and empty file).
    Info-ZIP writes 1.0 for stored entries, and Archive Utility rejects the 2.0
    directory entries.

    After applying the fix, stored/directory entries correctly report v1.0, the
    archive opens normally in Archive Utility, and the full test suite still passes
    — no longer reproducible on my machine.

    I opened a PR with the one-line fix: #563

    Would appreciate a review 🙏 /cc @cthackers

  2. added a commit that references this issue on Jun 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions