ZipArchive /ZipArchive
ZipArchive is a simple utility class for zipping and unzipping files on iOS, macOS and tvOS.
★ 5,604⑂ 1,348👁 150⑃ 281● 480▤ 43
+0
日增长
5,604
stars
1,348
forks
150
watchers
281
prs
480
issues
43
releases
README
SSZipArchive ZipArchive is a simple utility class for zipping and unzipping files on iOS, macOS, tvOS, watchOS and visionOS. - Unzip zip files; - Unzip password protected zip files; - Unzip AES encrypted zip files; - Create zip files; - Create large ( 4.3Gb) files; - Create password protected zip files; - Create AES encrypted zip files; - Choose compression level; - Zip-up NSData instances. (with a filename) Version 2.5.0+ Updates Minimum OS Versions A key dependency of this project is the zlib library. zlib before version 1.2.12 allows memory corruption when deflating (i.e., when compressing) if the input has many distant matches according to CVE-2018-25032. zlib 1.2.12 is included in macOS 10.15+ (with latest security patches), iOS 15.5+, tvOS 15.4+, watchOS 8.4+. As such, these OS versions will be the new minimums as of version 2.5.0 of ZipArchive. If you need support for previous versions of ZipArchive for earlier OS support you can target an earlier version but know you will be using an unmaintained version of this library. We will not support versions of ZipArchive that use dependencies with known vulnerabilities. Alternatives Konwn popular alternatives to ZipArchive: Zip from marmelroy, Swift, based on minizip-ng too. ZIPFoundation from weichsel, Swift, direct layer over zlib. Installation and Setup The main release branch is configured to support Objective-C and Swift 4+. ZipArchive works on: - Xcode 12 and above - iOS 15.5 and above - macOS 10.15 and above - tvOS 15.4 and above - visionOS 1.0 and above - watchOS 8.4 and above CocoaPods In your Podfile: pod 'SSZipArchive' You should define your minimum deployment target explicitly, like: platform :ios, '15.5' Recommended CocoaPods version should be at least CocoaPods 1.7.5. SPM Add a Swift Package reference to https://github.com/ZipArchive/ZipArchive.git (SSZipArchive 2.5.0 and higher or master) Carthage In your Cartfile: github "ZipArchive/ZipArchive" We do not release a Carthage pre-built package. Developers are encouraged to build one themselves. Manual 1. Add the SSZipArchive and minizip folders to your project. 2. Add the libz and libiconv libraries to your target. 3. Add the Security framework to your target. 4. Add the following GCC_PREPROCESSOR_DEFINITIONS: HAVE_ARC4RANDOM_BUF HAVE_ICONV HAVE_INTTYPES_H HAVE_PKCRYPT HAVE_STDINT_H HAVE_WZAES HAVE_ZLIB ZLIB_COMPAT $(inherited). ZipArchive requires ARC. Usage Objective-C objective-c //Import "import " for SPM/Carthage, and "import " for CocoaPods. // Create [SSZipArchive createZipFileAtPath:zipPath withContentsOfDirectory:sampleDataPath]; // Unzip [SSZipArchive unzipFileAtPath:zipPath toDestination:unzipPath]; Swift swift //Import "import ZipArchive" for SPM/Carthage, and "import SSZipArchive" for CocoaPods. // Create SSZipArchive.createZipFileAtPath(zipPath, withContentsOfDirectory: sampleDataPath) // Unzip SSZipArchive.unzipFileAtPath(zipPath, toDestination: unzipPath) Licens
Top issues
#384unzip shift-ijs file is failed14 comments · 2017-09-27#478Zip can not be unziped by SSZipArchive while work well on macOS default unzip app13 comments · 2018-10-03#473DEFINES_MODULE bug with pch imports (CocoaPods/CocoaPods#7584)13 comments · 2018-09-18#539Error Domain=SSZipArchiveErrorDomain Code=-1 "failed to open zip file" UserInfo={NSLocalizedDescription=failed to open zip file}11 comments · 2019-09-25#581zip with password for .sqlite in Objective C10 comments · 2020-07-05#236ignore parentDirectory when unzipping9 comments · 2016-02-09#374How to cancel zipping? and how to show progress when zipping?8 comments · 2017-09-10#585zip and unzip question7 comments · 2020-08-11
Latest release
2.6.0 2.6.0 2024-10-03- Add visionOS support (703) - Upgrade minizip to 3.0.10 (702) - Fix zip creation for file permissions and unicode symlinks (716) - withContentsOfDirectory: should return error when parameter isn't a directory (718) - withFilesAtPaths: should not write a file when parameter is a directory (718) - Skip directories in isPasswordValidForArchiveAtPath (462) - Silence unused rand() warning (712)