I'm trying to decompress programmatically a gzip file into memory and mimic the command gzip -d file.gz
using libarchive project.
The file is actually taken from http response with the following header Accept-Encoding: gzip, deflate
Here my attempt to read the file. I don't expect not to work since the gzipped file has no entries (it's compressed as a stream) and archive_read_next_header
tries to read the next file out of the arcihve.
Are there any alternative to this function that extract the entire data out of the compressed file.
archive_read_support_format_raw(archive);
archive_read_support_filter_all(archive);
archive_read_support_compression_all(archive)
archive_read_open_memory(archive, file_data, file_size);
struct archive_entry *entry;
la_ssize_t total, size;
char *buf;
int status = archive_read_next_header(archive, &entry);
Perhaps someone can post minimal code example that resolve this issue ? Also, Is there an option to find out whether a gzip archive file has entries or not ?