Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Untar" file on iPhone

I'm writing an iPhone app which downloads a tar-gzipped file from a Webserver, then needs to unarchive this file so that it can be copied into the app's Documents folder.

I'm using tar/gzip because I want to download a whole bunch of small files in one HTTP request, to make everything nice and fast.

I've investigated solutions like http://www.feep.net/libtar/, but as a C/Objective-C newb, I can't get any of them to compile for the iPhone platform.

(I felt like I should just be able to do a system call to "tar -zxvf myfile.tar.gz", but it would appear it's not that easy!)

So is there a simple way to just un-tar a file on the iPhone? Or am I going about this all wrong, and is there a better way to do this?

Thanks in advance!

Nik

like image 902
nikz Avatar asked Nov 28 '09 04:11

nikz


3 Answers

This blog post should help you: http://blog.hawkey.org/?p=332

EDIT: Google cache version of the same page which actually links to a forum post here which links to a Google Code project here, containing some code which implements unzipping on iOS.

like image 188
Ken Aspeslagh Avatar answered Oct 08 '22 06:10

Ken Aspeslagh


Here is a light untar library for iOS : https://github.com/mhausherr/Light-Untar-for-iOS

Complete blog post about the solution : http://blog.octo.com/en/untar-on-ios-the-pragmatic-way/

Hope this helps, Vincent

like image 4
vdaubry Avatar answered Oct 08 '22 06:10

vdaubry


I took a different approach by building libarchive and bz2lib as a static library for iOS. You can find it here:

http://github.com/davepeck/iOS-libarchive/

like image 1
Dave Peck Avatar answered Oct 08 '22 05:10

Dave Peck