How to save or socket an archive from memory?
FreeM1ne opened this issue · 3 comments
I use this code to open an archive in memory
zip_t* zipArchive = zip_open_from_source(zip_source_buffer_create(nullptr, 0, 0, nullptr), 0, nullptr);
I managed to solve the problem with file-by-file transfer to a new created archive, but I think there must be a better solution, also there is still a question how to send the archive from memory via sockets.
This has nothing in particular to do with libzip.
This has nothing in particular to do with libzip.
Basically, you zip_source_keep()
your buffer source before passing it to zip_open_from_source()
, and after finishing the archive with zip_close()
, you use zip_source_open()
and zip_source_read()
to read the zip archive. You can then write it to a file or send it over the network like any other data.