Hello, I've found a couple of libs (LiteZip and ZipArchive) that allow to unzip files on iPhone. But both of them require an input as a file. Is there a library that allows to directly unzip NSData containing zip-archived data without writing it to temporary file?
I've tried to adopt mentioned above libs for that, but with no success so far.
views:
583answers:
3
+1
A:
From what I understand, the zip format stores files separately and each stored file is compressed using a compression algorithm (generally it's the DEFLATE algorithm).
If you're only interested in uncompressing data that was compressed using the DEFLATE algorithm you could use this zlib addition to NSData from Google Toolbox For Mac
It doesn't need temporary files.
Jean Regisser
2009-11-13 12:22:31
Since files in zip archives are stored individually compressed, And in their original folder hierarchy, it should be possible to extract an NSData object by simply passing a path (relative to the root of the zip archive), right?
avocade
2010-06-08 00:15:33
+1
A:
In this answer to this question, I point out the CocoaDev wiki category on NSData which adds zip / unzip support to that class. This would let you do this entirely in memory.
Brad Larson
2009-11-13 13:36:15
This category adds gzip/zlib support, not the actual zip format (which by the way couldn't be decompressed to a single NSData object that cannot represent the files/directories structure).
Jean Regisser
2009-11-13 14:02:39
A:
See also:
NSData+GZip adds gzip compression / decompression methods to NSData
ceeit
2010-08-22 14:06:09
That's useful for decompressing a single file. But it won't help with the file index and locating the decompressed data within the file. And it's no help for decryption.
Codo
2010-08-22 14:27:20