Does libarchive support plain text files that are GZIP compressed?

Skip to first unread message

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

Apr 1, 2018, 12:31:36 AM4/1/18
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.



Reply all
Reply to author
0 new messages