I need to decompress a gzip file that contains other files and directories, and save these files separately, it is possible to do this in iOS?
My compressed file has the following structure
file.tar.bz2
- db_update.sql
- Tmp /
- image.png
- image2.png
I found documentation that shows how to do that, but only for when the archive is a single file.
Need to save it in the same archive's structure, is possible?
There are two things you can do here.
tar
. For tar, use libarchive
.gzip
to zip
. zip
(also called PK zip) can compress a directory structure instead of just a single file. For zip
look into minizip
.As @Kevin stated in a comment, you already have a tar
ed file. If you want to go with a .tar.gz format (sometimes given as .tgz), then you only need to decompress the bzip2
part of file.tar.bz2
, which will leave you with a file.tar
. At that point you can recompress with gzip.