DTZipArchive Class Reference
Inherits from | NSObject |
Declared in | DTZipArchive.h |
Overview
This class represents a compressed file in GZIP or PKZIP format. The used format is auto-detected.
Dependencies: minizip (in Core/Source/Externals), libz.dylib
Properties
nodes
The nodes at the root level of the archive. Each node is a DTZipArchiveNode and can represent either a folder or a file. This forms the directory hierarchy of the archive.
@property (nonatomic, readonly) NSArray *nodes
Declared In
DTZipArchive.h
Class Methods
archiveAtPath:
Creates an instance of DTZipArchive in preparation for enumerating its contents.
+ (DTZipArchive *)archiveAtPath:(NSString *)path
Parameters
- path
A Path to a compressed file
Return Value
An instance of DTZipArchive or nil
if an error occured
Discussion
Uses the minizip wrapper for zlib to deal with PKZip-format files.
Declared In
DTZipArchive.h
Instance Methods
cancelAllUncompressing
Cancels an uncompressing operation started by uncompressToPath:completion:.
- (void)cancelAllUncompressing
Declared In
DTZipArchive.h
enumerateUncompressedFilesAsDataUsingBlock:
Enumerates through the files contained in the archive.
- (void)enumerateUncompressedFilesAsDataUsingBlock:(DTZipArchiveEnumerationResultsBlock)enumerationBlock
Parameters
- enumerationBlock
An enumeration block that gets executed for each found and decompressed file
Discussion
If stop is set to YES
in the enumeration block then the enumeration stops. Note that this parameter is ignored for GZip files since those only contain a single file.
Declared In
DTZipArchive.h
uncompressToPath:completion:
Uncompresses the receiver to a given path overwriting existing files. Can be cancelled by calling cancelAllUncompressing. For a cancelled operation the completion block will not be called.
- (void)uncompressToPath:(NSString *)targetPath completion:(DTZipArchiveUncompressionCompletionBlock)completion
Parameters
- targetPath
path where the zip archive is being uncompressed
- completion
block that executes when uncompressing is finished. Error is
nil
if successful.
Declared In
DTZipArchive.h
uncompressZipArchiveNode:toDataWithCompletion:
Asynchronous uncompressing of single file with completion block
- (void)uncompressZipArchiveNode:(DTZipArchiveNode *)node toDataWithCompletion:(DTZipArchiveUncompressFileCompletionBlock)completion
Parameters
- node
from the listOfEntries property of DTZipArchiveNodes
- completion
block that is called when the unzipping of this file is done
Declared In
DTZipArchive.h
uncompressZipArchiveNode:withError:
Synchronous uncompressing the receiver and returning file as NSData
- (NSData *)uncompressZipArchiveNode:(DTZipArchiveNode *)node withError:(NSError **)error
Parameters
- node
path where the zip archive is being uncompressed
- error
the error returned when something went wrong
Return Value
data of uncompressed file. If nil error has occured.
Declared In
DTZipArchive.h