12

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

nikz
  • 498
  • 4
  • 11

3 Answers3

4

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.

tomfanning
  • 9,552
  • 4
  • 50
  • 78
Ken Aspeslagh
  • 11,484
  • 2
  • 36
  • 42
4

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

vdaubry
  • 11,369
  • 7
  • 54
  • 76
1

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/

Dave Peck
  • 1,342
  • 1
  • 17
  • 24