0
votes

I need to create a big table to csv file and compress it.

I can create the csv file like this: Xcode - Create csv/spreadsheet file

It is possible compress it with GZIP?

Thanks for all.

Best regards.

2

2 Answers

1
votes

I recommend you use SSZipArchive: https://github.com/soffes/ssziparchive

Then you can do:

NSString *content = @"1,2,3"
NSString *path = [NSTemporaryDirectory() stringByAppendingPathComponent:@"somefile.zip"];
SSZipArchive *zip = [[SSZipArchive alloc] initWithPath:path];
[zip open];
[zip writeData:[content dataUsingEncoding:NSUTF8StringEncoding] filename:@"data.csv"];
[zip close];

That will produce a zip file named "somefile.zip" in the temporary directory, containing one file inside named "data.csv"

0
votes

The easiest way is to probably not use a standard copy build phase to move the file into place, but instead use shell script build phase to copy the file and then compress it in place with gzip.