Skip to content

Buffer archive bytes in the ZIP example - #1166

Open
nhz2 wants to merge 1 commit into
JuliaData:mainfrom
nhz2:nz/update-zip-file-example-again
Open

nhz2 wants to merge 1 commit into
JuliaData:mainfrom
nhz2:nz/update-zip-file-example-again

Conversation

@nhz2

@nhz2 nhz2 commented Aug 21, 2025 •

Copy link
Copy Markdown
Contributor

As noted by @JakeZw in #1158 (comment)

The zip file example was not properly closing things.
And as noted in JuliaIO/ZipArchives.jl#90, using mmap might not always be ideal.

This PR changes the example to avoid using streaming or mmap and instead buffers everything in memory to keep things simple.

I can give a more complete example based on the code in https://github.com/JuliaIO/ZipArchives.jl/blob/v2.5.1/test/test_file-array.jl
But this can get more complicated.

@codecov

codecov Bot commented Aug 21, 2025 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.75%. Comparing base (a0335ff) to head (b2e1330).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1166   +/-   ##
=======================================
  Coverage   95.75%   95.75%           
=======================================
  Files           9        9           
  Lines        5489     5489           
=======================================
  Hits         5256     5256           
  Misses        233      233           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@quinnj

quinnj commented Sep 19, 2026

Copy link
Copy Markdown
Member

[Reviewed by AI] Scoped review of the example at 8cf0b96.

Both zip-writing variants round-trip correctly through the proposed ZipReader(read(...)) / zip_readentry path with ZipArchives 2.5.1, CSV main ff0c032, and Julia 1.12.6. The shell-mode line was run as run(...) in the script.

Current main already closes the archive file through open(mmap, "a.zip") and uses zip_readentry. The remaining change is the choice to buffer the compressed archive with read. Keep the memory note: this example holds the archive bytes and the uncompressed entry bytes. Please port that small change onto current docs; this PR currently has 154 changed files and merge conflicts. I did not test the full historical PR checkout.

Adapt nhz2's buffered ZIP example to the current documentation, retaining
the byte-based entry reader. Describe both archive and entry buffering
and link the original file-backed alternative for larger archives.

AI disclosure: This work was prepared with assistance from OpenAI Codex.

Co-authored-by: nhz2 <nhz2@cornell.edu>
@quinnj quinnj changed the title Improve zip file example Buffer archive bytes in the ZIP example Oct 4, 2026
@quinnj
quinnj force-pushed the nz/update-zip-file-example-again branch from 8cf0b96 to b2e1330 Compare October 4, 2026 09:27

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants