我试图以编程方式将gzip文件解压到内存中并模拟命令
gzip -d file.gz
libarchive project
.
Accept-Encoding: gzip, deflate
这是我试图读取的文件。我不希望不工作,因为gzip文件没有条目(它被压缩为流)并且
archive_read_next_header
尝试从arcihve中读取下一个文件。
是否有任何替代此函数的方法从压缩文件中提取整个数据。
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);
也许有人可以发布最小的代码示例来解决这个问题?
另外,是否有一个选项来确定gzip存档文件是否有条目?