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
Feature: Add archiving functionality (zip/tar/..) #65
Comments
Hi @gsantner, Thank you for your input! We've discussed a possible solution with @inlife and concluded we could expand the file API by providing the necessary tools to manipulate archived files. While we won't roll our compression library for ZPL, we will support the most common libraries we would use internally to manipulate the data. As a user, one can enable the support of a specific user-supplied third-party compression library without the need of having to use the third-party library themselves directly. We didn't discuss the design yet, but it is something worth looking into in the future. Please, feel free to share any design suggestions if you can think of something. It would be very appreciated! :) |
Sorry to say, but disagree.
|
Thank you, we will re-iterate the approach in that case. TAR support sounds reasonable indeed, thank you for providing some examples. As for compression, fortunately, it's a topic that can be dealt with outside of ZPL, so I agree the focus should stay on archiving itself.
We could introduce a basic set of methods to pack/unpack a set of files/folders and manipulate the archive (add/remove/edit entries). |
Only thing I could think off for the "VFS" task is: Taking care of "vendor" file restrictions, like on iOS & Android with StorageAccessFramework - but I guess thats a too big point for ZPL. As noted on description, what I see as "main goal": To be able to quickly zip up some folders and files to have a single file that can be copied to a backup folder...can be sent over network .. like that. And reversed, being able to unpack it. |
The set of methods I'd propose to introduce: zpl_tar_init(zpl_tar*)
zpl_tar_destroy(zpl_tar*)
zpl_tar_add_file(zpl_tar*, path, zpl_file*)
zpl_tar_add_dir(zpl_tar*, path, zpl_dir_info*)
zpl_tar_add_path(zpl_tar*, path, char const* os_path) // resolves path and adds file/folder
zpl_tar_rem_entry(zpl_tar*, path)
zpl_tar_pack(zpl_tar*, zpl_allocator, &size)
zpl_tar_unpack(zpl_tar*, zpl_file*)
zpl_tar_unpack_buffer(zpl_tar*, buffer, len) would this work out for the feature to be implemented? I think this wouldn't bring much of an overhead to the library and it should still provide all the necessary tools to support the criteria. The list above should give a rough idea of the design but is not final. |
I guess
is enough yes. Note that I currently don't make use of zpl yet, I just discovered this project these days. But this is one of the things that came to my mind and thought to suggest 😄 |
That would work fine, thank you again for the suggestion, I will keep you updated on the progress. :) |
please see the comment below |
Hi @gsantner, please check out https://github.com/zpl-c/zpl/releases/tag/12.5.0-pre.0 to see whether this approach is suitable. Example code can be found at https://github.com/zpl-c/zpl/blob/review/tar-archive/code/apps/examples/tar.c Thank you for your feature request! Note: |
|
You can pack folders as well, using |
OK haven't compared the code, just saw the mention :D. |
This is the final proposed API: zpl_isize zpl_tar_pack(zpl_file *archive, char const **paths, zpl_isize paths_len);
zpl_isize zpl_tar_pack_dir(zpl_file *archive, char const *path, zpl_allocator alloc);
zpl_isize zpl_tar_unpack(zpl_file *archive, zpl_tar_unpack_proc *unpack_proc, void *user_data);
zpl_isize zpl_tar_unpack_dir(zpl_file *archive, char const *dest);
|
I would swap paths and length, but thats totally personal taste.
Overall I guess it's fine, but still sorry didn't make it to try zpl yet :D |
That's fine, thanks a lot for the feature request, I think it's a great addition to the library! @inlife and I will review the PR soon, once merged we can possibly close this issue. 👍🏻 |
TAR functionality has been incorporated into https://github.com/zpl-c/zpl/releases/tag/12.3.0. Closing this issue now, but feel free to re-open it if need be. |
Hey, just looked at the combined-header file and the available functionalities/modules at readme.
I thought maybe some kind of archiving functionality could fit well for this library as well, due there are File related functionalites. So quickly zip up a folder, or i.e. two files to create a backup of i.e. application configuration + some images.
Don't really implying any preference, whatever is easy and short (LOC/singleheader) to implement ... zip?tar?
Maybe minizip has something to offer.
Feel free to close if you don't think it fits for the project.
The text was updated successfully, but these errors were encountered: