2015-11-07 08:48:00 -08:00
2016-05-31 13:21:33 -07:00
[](https://travis-ci.org/ZipArchive/ZipArchive)
2015-10-24 17:25:50 -04:00
# SSZipArchive
2015-04-06 15:44:13 -04:00
2017-10-09 02:28:16 -05:00
ZipArchive is a simple utility class for zipping and unzipping files on iOS, macOS and tvOS.
2015-04-06 15:44:13 -04:00
2015-10-23 11:52:53 -04:00
- Unzip zip files;
- Unzip password protected zip files;
2017-10-09 02:28:16 -05:00
- Unzip AES encrypted zip files;
- Create zip files;
- Create password protected zip files;
- Create AES encrypted zip files;
- Choose compression level;
2015-10-23 11:52:53 -04:00
- Append to existing zip files;
- Zip-up NSData instances. (with a filename)
2015-04-06 15:44:13 -04:00
2015-10-23 11:52:53 -04:00
## Installation and Setup
2017-10-10 11:29:22 +08:00
* The main release branch is configured to support Objective C and Swift 3+. *
2016-09-21 08:53:11 -07:00
2017-09-13 15:54:43 +08:00
SSZipArchive works on Xcode 7-9 and above, iOS 8-11 and above.
2015-10-23 11:52:53 -04:00
### CocoaPods
2017-07-20 20:52:11 +08:00
In your Podfile:
`pod 'SSZipArchive'`
2015-07-12 12:52:18 +01:00
2015-12-21 13:33:41 +00:00
### Carthage
2017-07-20 20:52:11 +08:00
In your Cartfile:
2015-12-21 13:33:41 +00:00
`github "ZipArchive/ZipArchive"`
2015-10-23 11:52:53 -04:00
### Manual
2015-07-12 12:52:18 +01:00
2015-10-23 11:52:53 -04:00
1. Add the `SSZipArchive` and `minizip` folders to your project.
2. Add the `libz` library to your target
SSZipArchive requires ARC.
## Usage
2015-04-06 15:44:13 -04:00
2015-10-23 14:23:12 -04:00
### Objective-C
2015-04-06 15:44:13 -04:00
```objective-c
2015-10-23 11:52:53 -04:00
// Create
2017-10-09 02:28:16 -05:00
[SSZipArchive createZipFileAtPath:zipPath withContentsOfDirectory:sampleDataPath];
2015-10-23 11:52:53 -04:00
// Unzip
2017-10-09 02:28:16 -05:00
[SSZipArchive unzipFileAtPath:zipPath toDestination:unzipPath];
2015-04-06 15:44:13 -04:00
` ``
2016-09-14 10:33:38 -07:00
### Swift
2015-10-23 14:23:12 -04:00
2015-10-23 11:52:53 -04:00
` ``swift
// Create
SSZipArchive.createZipFileAtPath(zipPath, withContentsOfDirectory: sampleDataPath)
// Unzip
SSZipArchive.unzipFileAtPath(zipPath, toDestination: unzipPath)
` ``
## License
2017-10-09 02:28:16 -05:00
SSZipArchive is protected under the [MIT license ](https://github.com/samsoffes/ssziparchive/raw/master/LICENSE ) and our slightly modified version of [Minizip ](https://github.com/nmoinvaz/minizip ) 1.2 is licensed under the [Zlib license ](http://www.zlib.net/zlib_license.html ).
2015-10-23 11:52:53 -04:00
## Acknowledgments
2017-07-20 20:52:11 +08:00
* Big thanks to [aish ](http://code.google.com/p/ziparchive ) for creating [ZipArchive ](http://code.google.com/p/ziparchive ). The project that inspired SSZipArchive.
* Thank you [@soffes ](https://github.com/soffes ) for the actual name of SSZipArchive.
* Thank you [@randomsequence ](https://github.com/randomsequence ) for implementing the creation support tech.
* Thank you [@johnezang ](https://github.com/johnezang ) for all his amazing help along the way.