Skip to content

Support zip64 archives larger than 4 GiB - #352

Merged
slimbuck merged 2 commits into
playcanvas:mainfrom
slimbuck:z64-dev
Oct 7, 2026
Merged

slimbuck merged 2 commits into
playcanvas:mainfrom
slimbuck:z64-dev

Conversation

@slimbuck

@slimbuck slimbuck commented Oct 7, 2026

Copy link
Copy Markdown
Member

Removes the 4 GiB limit on zip output, so .sog bundles and other archives written by ZipFileSystem can grow past 4 GiB or 65,535 entries.

  • ZipFileSystem uses zip64 only where a value doesn't fit: an entry of 4 GiB or more, an entry starting past 4 GiB, or 65,535 or more entries. Archives under the limits are byte-identical to before.
  • Entries over 4 GiB are streamed the same way Go's archive/zip and Java's ZipOutputStream do it: the large size is recorded after the data and in the central directory, because the header is written before the size is known.
  • ZipReadFileSystem reads zip64 archives, so splat-transform can read back what it writes.
  • New tests in test/zip-file-system.test.mjs. A hidden ZipFileSystem.zip64Limit setting lets them trigger zip64 without writing 4 GiB.

Tested by hand on real 4.4 GB and 4.5 GB archives with unzip -t, Python zipfile.testzip() and bsdtar (direct and streamed), and by reading a 4.3 GB zip64 archive written by Python.

Note: the PlayCanvas engine's zip parser doesn't support zip64 yet, so .sog bundles over 4 GiB won't load in the engine.

@slimbuck
slimbuck requested a balanced review from Copilot October 7, 2026 18:58
@slimbuck slimbuck self-assigned this Oct 7, 2026
@slimbuck slimbuck added the enhancement New feature or request label Oct 7, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

ZIP64 archives with large valid EOCD comments can fail because locator lookup assumes it is present in the tail buffer.

1 open finding
What changed in this PR

Adds ZIP64 support so archives can exceed classic ZIP size and entry-count limits.

Changes:

  • Writes ZIP64 entry metadata and end records when required.
  • Reads ZIP64 directory records and extended entry fields.
  • Adds coverage for classic and ZIP64 layouts.
File Description
src/​lib/​io/​write/​zip-file-system.ts Emits ZIP64 metadata for overflowing fields.
src/​lib/​io/​read/​zip-file-system.ts Parses ZIP64 directories and entry metadata.
test/​zip-file-system.test.mjs Tests ZIP64 sizes, offsets, counts, and round trips.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/lib/io/read/zip-file-system.ts
@slimbuck
slimbuck requested a review from a team October 7, 2026 19:29
@slimbuck
slimbuck merged commit 148df4f into playcanvas:main Oct 7, 2026
3 checks passed
@slimbuck
slimbuck deleted the z64-dev branch October 7, 2026 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants