Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to uncompress a gzip file and write that out to an uncompressed file, on iPhone

Tags:

ios

iphone

gzip

I've got a file, bigfile.gz, in the bundle of my iPhone app. At app start, I want to gunzip that file to my Documents directory within my app. How can I achieve this programmatically?

Basically I want the effect of: gunzip bigfile.gz.. obviously a gunzip utility is not available in the iOS environment though.

like image 708
Nektarios Avatar asked Jul 18 '11 23:07

Nektarios


People also ask

Can zip unzip gzip files?

There are many free apps on the market to unzip a GZ file on your PC. 7-Zip is a pretty good choice for this task, as it's easy, free, and open-source. Here's how you use this app to decompress GZ archives on your PC: Download and install the free 7-Zip tool on your PC.

How do you compress files on iPhone?

How to Compress a File or Folder on iPhone and iPad. Launch the Files app on your ‌iPhone‌ or ‌iPad‌. Find the file or folder that you want to compress. Press and hold on the file or folder, then select Compress from the contextual menu.


1 Answers

As pointed out in this post:

Compression API on the iPhone

both zlib and bzip2 are available. However, as another answer there points out, if you store the data for the conversations in an NSData object, then you can use an NSData category that adds gzip and zlib compression / decompression as simple methods. Here's a useful link for that.

like image 80
PengOne Avatar answered Oct 02 '22 15:10

PengOne