我正在尝试将现有的 Android 应用程序移植到 iOS, 在 Android 应用程序中,我使用 ZipInputStream 从 zip 存档中提取单个文件并将其存储为临时文件。
如何从 Zip 存档中提取单个文件,而不必提取整个存档(因为它非常大)?
最佳答案
我刚刚找到了答案,
我必须修改 SSZipArchive 以插入一个方法,该方法将从 ZIP 存档中提取单个文件(基于其名称)
您可以找到the modified version here ,如果有人发现这有用,我可能会清理它,添加委托(delegate)、测试并建议拉入 SSZipArchive。
使用很简单:
NSString *zipEntityToExtract = @"example.aac";
NSString *destinationFilePath = ...; //(Includes filename)
NSString *zipPath = ...;
[SSZipArchive unzipEntityName:zipEntityToExtract fromFilePath:zipPath toDestination:filePath];
//File is now in destinationFilePath
关于ios - 从存档中解压缩单个文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25016006/