Monday, 26 August 2013

How to get properties of an archived file in a zip file?

How to get properties of an archived file in a zip file?

I have an xml file. I compressed it into zip file using zipArchive.Now I
initialize an NSMutableData with this zip file. I want to get the
compressed size of the xml file from zip file. According to the zip file
specification,compressed size is stored in the range of bytes 18 to 4.
NSData *data = [mdata subdataWithRange:NSMakeRange(18,4)];
NSMutableData *mdata = [[NSMutableData
alloinitWithContentsOfFile:@"./test.zip"];
This will give the data in bytes. How can I get the compressed size as an
integer? The compressed size of the xml file is 207 (I got this from
inflate and deflate functions of zlib). How is this possible? Like the
compressed size I want to extract other properties also like uncompressed
size, file name length etc.

No comments:

Post a Comment