Does libarchive support plain text files that are GZIP compressed?

27 views
Skip to first unread message

je...@taltos.com

unread,
Mar 31, 2018, 3:58:10 PM3/31/18
to libarchive-discuss
I'm trying to have libarchive process a plain text file, like this:

echo "Hello world (.gz format)" > hello
gzip hello

I now have a "hello.gz" file (not a tar file or anything).

If I pass that to libarchive to extract, it returns an error and won't handle this.

Is there a way to make libarchive handle plain text files that are compressed (not a .tar archive or anything)?

Thanks in advance for any help!

Tim Kientzle

unread,
Apr 1, 2018, 12:31:36 AM4/1/18
to je...@taltos.com, libarchiv...@googlegroups.com
You can enable `archive_read_support_format_raw()` to allow arbitrary data to be returned as if it were wrapped in a single-item archive.

This allows you to use libarchive's automatic decompression support with contents that are not in fact archives.

The "raw" handler is deliberately not enabled by default because it breaks libarchive's error handling. With "raw" enabled, for example, a damaged uncompressed tar archive will be returned as binary data, without extracting the contents and without any error.

Cheers,

Tim



Reply all
Reply to author
Forward
0 new messages