camlzip icon indicating copy to clipboard operation
camlzip copied to clipboard

Adding a new entry to an existing zip file.

Open zoj613 opened this issue 1 year ago • 1 comments

The documentation of Zip.open_out suggests that opening an existing zip file to add new entries will truncate it to zero length. As far as i'm aware, zip files allow adding new entries. Is there a way to add an entry to an existing zip file using this library without copying all existing entries to a temporary directory then adding them to a new empty zip together with the new entry?

zoj613 avatar Sep 13 '24 01:09 zoj613

You're correct that the Camlzip library currently does not support adding new entries to an existing ZIP file. You can, however, create a new ZIP file, copy all entries from the old ZIP file to the new ZIP file, then add the new entries.

I'll leave this issue open as a feature wish for future Camlzip development.

xavierleroy avatar Sep 14 '24 16:09 xavierleroy

Implemented Zip.open_update in f85582b. Will be released in version 1.13, it should support the use case mentioned here.

xavierleroy avatar Oct 23 '24 12:10 xavierleroy

Implemented Zip.open_update in f85582b. Will be released in version 1.13, it should support the use case mentioned here.

Thank you for the quick update. I tried it and it works well.

zoj613 avatar Oct 27 '24 21:10 zoj613