CCSSZipArchive 0.0.2

CCSSZipArchive 0.0.2

ai mac 维护。



  • CC

SSZipArchive

SSZipArchive 是一个用于压缩和解压缩文件的简单实用工具类。功能

  • 解压 zip 文件
  • 解压带密码保护的 zip 文件
  • 创建 zip 文件
  • 追加到 zip 文件
  • 压缩文件
  • 使用文件名压缩 NSData

添加到你的项目中

  1. SSZipArchiveminizip 文件夹添加到你的项目中。
  2. libz 库添加到你的目标中

SSZipArchive 需要ARC。

用法

// Unzipping
NSString *zipPath = @"path_to_your_zip_file";
NSString *destinationPath = @"path_to_the_folder_where_you_want_it_unzipped";
[SSZipArchive unzipFileAtPath:zipPath toDestination:destinationPath];

// Zipping
NSString *zippedPath = @"path_where_you_want_the_file_created";
NSArray *inputPaths = [NSArray arrayWithObjects:
                       [[NSBundle mainBundle] pathForResource:@"photo1" ofType:@"jpg"],
                       [[NSBundle mainBundle] pathForResource:@"photo2" ofType:@"jpg"]
                       nil];
[SSZipArchive createZipFileAtPath:zippedPath withFilesAtPaths:inputPaths];

测试

简单来说,打开 Tests 目录中的 Xcode 5 或更高版本的工程,然后按 Command-U 运行测试。

协议

SSZipArchive遵循MIT协议。还包括对Minizip 1.1的略微修改版本,并遵循Zlib协议

感谢

感谢aish创建了基于此的ZipArchive,感谢Johnnie Walker(《@randomsequence》)实现创建支持,以及John Engelhart(《@johnezang》)在整个过程中的所有帮助。