HMJ-29

文件的压缩和解压缩

(1)说明

    使用ZipArchive来压缩和解压缩文件需要添加依赖库(libz),使用需要包含Main文件,如果使用cocoaPoads来安装框架,那么会自动的配置框架的使用环境

(2)相关代码
//压缩文件的第一种方式
/*
 第一个参数:压缩文件要保存的位置
 第二个参数:要压缩哪几个文件
 */
[Main createZipFileAtPath:fullpath withFilesAtPaths:arrayM];

//压缩文件的第二种方式
/*
 第一个参数:文件压缩到哪个地方
 第二个参数:要压缩文件的全路径
 */
[Main createZipFileAtPath:fullpath withContentsOfDirectory:zipFile];

//如何对压缩文件进行解压
/*
 第一个参数:要解压的文件
 第二个参数:要解压到什么地方
 */
[Main unzipFileAtPath:unZipFile toDestination:fullpath];

 

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2021-11-30
  • 2022-01-23
  • 2021-11-30
  • 2021-12-27
  • 2021-12-17
  • 2021-11-21
猜你喜欢
  • 2022-01-27
  • 2021-12-17
  • 2021-11-05
  • 2021-08-10
  • 2022-12-23
  • 2021-06-27
相关资源
相似解决方案