How to unzip a zip file already loaded in memory in C?
c, c++, unzip, zip
Solution
Take a look at libarchive It supports the zip format.
Example of extracting archive in memory:
struct archive *a = archive_read_new();
archive_read_support_compression_gzip(a);
archive_read_support_format_tar(a);
r = archive_read_open_memory(a, buff, sizeof(buff));
Problem
I am writing a server, which receive a zip file from client, and unzip the file. When I receiving the zip file, I store it into memory. I find and try some library to upzip a zip file, such zlib and minizip, but all of them unzip a file exists on disk, not from memory. I don't want to save the file into disk temperorily and extract it, it's not efficient. How to unzip a file from memory? I write C and C++ on Windows.