Skip to content

Latest commit

 

History

History
92 lines (71 loc) · 2.87 KB

README.zh_CN.md

File metadata and controls

92 lines (71 loc) · 2.87 KB

Perfect Zip English

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 项目模块封装了一个 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)")