Skip to content
This repository has been archived by the owner on Apr 28, 2022. It is now read-only.

Latest commit

 

History

History
42 lines (31 loc) · 1.4 KB

README.md

File metadata and controls

42 lines (31 loc) · 1.4 KB

SBYZipArchive

Build Status

SBYZipArchive is a simple unzip library to extract files from a large archive. You can extract contents without expanding the whole archive.

Usage

Synchronous extraction for a small file

NSURL *url = [NSURL URLWithString:@"zip_file_path"];

SBYZipArchive *archive = [[SBYZipArchive alloc] initWithContentsOfURL:url error:nil];
[archive loadEntriesWithError:nil];

SBYZipEntry *entry = archive.entries[0];

NSData *data = [entry dataWithError:nil];

Asynchronous extraction for a large file

NSURL *url = [NSURL URLWithString:@"zip_file_path"];

SBYZipArchive *archive = [[SBYZipArchive alloc] initWithContentsOfURL:url error:nil];
[archive loadEntriesWithError:nil];

SBYZipEntry *entry = archive.entries[0];

NSURL *destinationURL = [NSURL URLWithString:@"destination_directory_path"];

[entry unzipToURL:destinationURL success:^(NSURL *unzippedFileLocation) {
    NSData *data = [NSData dataWithContentsOfURL:unzippedFileLocation];
} failure:^(NSError *error) {
    NSLog(@"%@", error);
} progress:^(NSUInteger bytesUnzipped, NSUInteger totalBytes) {
    NSLog(@"progress:%f", (double)bytesUnzipped/totalBytes);
}];

License

SBYZipArchive is licensed under the MIT license. Included minizip is licensed under the zlib license.