Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request to Implement zip_commit() #479

Open
AlexKlo opened this issue Jan 9, 2025 · 4 comments
Open

Request to Implement zip_commit() #479

AlexKlo opened this issue Jan 9, 2025 · 4 comments
Labels
enhancement Request a new feature. feedback Waiting for feedback from submitter.

Comments

@AlexKlo
Copy link

AlexKlo commented Jan 9, 2025

Hello,

I'm currently developing a Julia package (LibZip.jl) based on your libzip library. While working with libzip, I noticed that committing changes to an archive requires calling zip_close(), which also closes the archive.

In the TODO.md file of this repository, I saw a mention of a zip_commit() function:

zip_commit() (to finish changes without closing archive)

This functionality would be useful, not only for my package. Would it be possible to consider prioritizing the implementation of the zip_commit() function?

Best regards,
AlexKlo

@AlexKlo AlexKlo added the enhancement Request a new feature. label Jan 9, 2025
@0-wiz-0
Copy link
Member

0-wiz-0 commented Jan 9, 2025

Can you please describe shortly what your use case(s) would be, and you would expect from zip_commit compared to zip_close + zip_open? I guess just performance? Thank you.

@0-wiz-0 0-wiz-0 added the feedback Waiting for feedback from submitter. label Jan 9, 2025
@AlexKlo
Copy link
Author

AlexKlo commented Jan 9, 2025

Thank you for your response!

The use case is as follows:

  • An empty archive is created, and data is added to it.

  • After that, the archive needs to be converted into a byte vector. To do this, the changes are committed using zip_close(), then the source is opened, and the data is read from it.

I will try the zip_close() + zip_open() approach, but it feels a bit unnatural for this workflow.

@0-wiz-0
Copy link
Member

0-wiz-0 commented Jan 9, 2025

Just to clarify: after you add data to it, you want a byte vector for the whole zip archive?
(in libzip context, a source is usually a data source for a file entry in the zip archive)
Why do you keep the archive open (on the libzip level)? It seems your work is done, so zip_close() seems sufficient.

@AlexKlo
Copy link
Author

AlexKlo commented Jan 9, 2025

Yes, I want byte vector for the whole zip archive.
To create the archive, zip_open_from_source is used, ensuring that the entire archive source is available.
What if I would like to commit some changes, send them over the network, and then continue working with the archive? Therefore, I would prefer not to interrupt the work with the archive.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Request a new feature. feedback Waiting for feedback from submitter.
Projects
None yet
Development

No branches or pull requests

2 participants