Perfect Zip 简体中文

Get Involed with Perfect!

Star Perfect On Github Stack Overflow Follow Perfect on Twitter Join the Perfect Slack

Swift 3.0 Platforms OS X | Linux License Apache PerfectlySoft Twitter Slack Status

Perfect Zip 实用工具

这个 Perfect 模块封装了 minizip C 库,并提供了简单的 zip 和 unzip 功能。

包含到你的项目中

在你的 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 Result: \(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("Unzip Result: \(UnZipResult.description)")

更多信息

有关 Perfect 项目的更多信息,请访问 perfect.org