untar and tar files on iOS and OS X. Also supports gzip tars.
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString* dataPath = [[paths objectAtIndex:0] stringByAppendingPathComponent:@"test.tar.gz"];
NSString* toPath = [[paths objectAtIndex:0] stringByAppendingPathComponent:@"testDir"];
[DCTar decompressFileAtPath:dataPath toPath:toPath error:nil];
##Tar
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString* toPath = [[paths objectAtIndex:0] stringByAppendingPathComponent:@"test.tar.gz"];
NSString* dataPath = [[paths objectAtIndex:0] stringByAppendingPathComponent:@"testDir"];
[DCTar compressFileAtPath:dataPath toPath:toPath error:nil];
It is important to know that all the file system based tar commands used chunked/buffer methods to save memory. Due to the fact that tars are normally used to compress lots of content, It is strongly recommend to use those method versus the in memory data options.
I got some of the tar code from here:
The recommended approach for installing tarkit is via the CocoaPods package manager (like most libraries).
pod 'tarkit', '~> 0.1.3'
tarkit requires at least iOS 5/OSX 10.7 or above.
tarkit is license under the Apache License.