Comments (3)
I just started using this version of miniz and have also discovered this problem. During my tests I called add to zip file (with the same "pArchive_name") a number of times. mz_zip_reader_get_num_files even includes the duplicates into the count. This doesn't feel like it's the proper behaviour. "_in_place" suggests it should overwrite if it doesn't exist.
I'm trying to figure out a workaround, but like I've said, I've only been using it for a couple of hours and only to create, add and read files from and to zip archives. A hint would be welcomed.
from miniz.
I got around it the hard way:
Try and open the zip file with "mz_zip_reader_init_file". If successful read the archive names and compare them to the new archive names to be added. If no duplicate found add them to a list of indices to keep. Create a write zip with "mz_zip_writer_init_file"using a temporary filename and clone the indices to keep from the read zip into the write_zip using "mz_zip_writer_add_from_zip_reader". When done, add the new data using either "mz_zip_writer_add_file" or "mz_zip_writer_add_mem"(if working from memory). Finally call "mz_zip_writer_finalize_archive" and then call mz_zip_writer_end and mz_zip_reader_end.
Then just delete the original zip file and rename the new zip file.
from miniz.
For what it's worth, I vaguely remember having similar issues with Python. And since stuff shifts around when replacing entries, I assume solving it on miniz's side might not be that easy either. So maybe the best solution is to just rewrite changing archives like @rebirth123 did.
from miniz.
Related Issues (20)
- Possibility to seek within iterative decompression HOT 1
- tinfl_decompress_mem_to_heap fails to decompress any input due to early exit in tinfl_decompress
- example-1 not working in ESP32 - compression failed
- MS Word files created with mz_zip_add_mem_to_archive_file_in_place() fail to open
- Miniz Errors in xtr1common
- How do I use this library? HOT 1
- Can I read some child files from a zip file, with a few limitation?
- mz_version() defined without prototype, causing warning, when MINIZ_NO_ZLIB_APIS defined
- Change crc32 define to something not so common.
- amalgamate.sh doesn't work on linux + musl-libc + arm64 systems, please provide a simple amalgamation command that works HOT 2
- Uninitialized variable: r->m_num_bits
- Minor issues compiling and running on a retro computer
- Compressing with small window size
- Integrity check fail on a ZIP64 file
- It does not seem to support decompressing the decompressed package of the split volume
- Compiler warnings on 32-bit HOT 1
- [Feature Request] Allow `mz_zip_writer_add_mem_ex_v2` to write metadata without requiring payload (`pBuf`)
- High inflate memory usage HOT 4
- We would like to ask you to add the newly released algorithm.(ECCPOW)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from miniz.