Perfect Zip English
Perfect Zip 压缩函数库
本 Perfect 项目模块封装了一个 C 函数库,并且提高简单的压缩和解压缩功能。
请修改 Package.swift 文件增加以下依存关系:
.Package(url: "https://github.com/PerfectlySoft/Perfect-Zip.git", majorVersion: 3)
下面的程序展示了一段如何进行压缩:
import PerfectZip
let zippy = Zip()
let thisZipFile = "/path/to/ZipFile.zip"
let sourceDir = "/path/to/files/"
let ZipResult = zippy.zipFiles(
paths: [sourceDir],
zipFilePath: thisZipFile,
overwrite: true, password: ""
)
print("压缩结果: \(ZipResult.description)")
以及解压缩文件:
import PerfectZip
let zippy = Zip()
let sourceDir = "/path/to/files/"
let thisZipFile = "/path/to/ZipFile.zip"
let UnZipResult = zippy.unzipFile(
source: thisZipFile,
destination: sourceDir,
overwrite: true
)
print("解压缩结果: \(UnZipResult.description)")