/ZipFile

Zip archive library for cocoa.

Primary LanguageObjective-C

ZipFile
Zip archive library for cocoa.

Kenji Nishishiro <marvel@programmershigh.org>


- Build instructions

1.Get Minizip library
http://www.winimage.com/zLibDll/minizip.html

2. Add files to Xcode project from Minizip
unzip11/crypt.h
unzip11/ioapi.c
unzip11/ioapi.h
unzip11/mztools.c
unzip11/mztools.h
unzip11/unzip.c
unzip11/unzip.h
unzip11/zip.c
unzip11/zip.h

3. Add external library to Xcode project
libz.dylib

4. Add preprocessor macro to Xcode project
USE_FILE32API

5. Add files to Xcode project from ZipFile
ZipFile.h ZipFile.m


- How to use ZipFile

ZipFile *zipFile = [[[ZipFile alloc] initWithFileAtPath:@"foo.zip"] autorelease];

// Open zip archive
if (![zipFile open]) {
	// Handle error
}

// Get file name list. 
// Hierarchy handling is unnecessary.
// File name includes pass separator, and list of file names gives back all file names.
NSArray *fileNames = [zipFile fileNames];
if (!fileNames) {
	// Handle error
}

// Get file contents.
// That will read all at a time, not suitable for huge file.
// For safety, please set maxLength.
NSData *data = [zipFile readWithFileName:@"baa.jpeg" maxLength:1024 * 1024];
if (!data) {
	// Handle error
}

// Close zip archive
[zipFile close];


- Licence

Copyright (c) 2010 Kenji Nishishiro

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.