问题描述
我正在尝试将现有的Android应用程序移植到iOS,
在Android应用程序中,我使用ZipInputStream从zip存档中提取单个文件并将其作为临时文件存储。
I'm trying to port an existing Android application to iOS,In the Android application i was using a ZipInputStream to extract a single file from the zip archive and store it in as a temporary file.
我如何从Zip档案中提取单个文件而不必提取整个档案(因为它非常大)?
How could i extract a single file from a Zip Archive without having to extract the whole archive (As it is very large)?
推荐答案
我刚刚找到答案,
我必须修改SSZipArchive以插入一个方法,从中提取单个文件ZIP存档(基于其名称)
I had to modify SSZipArchive to insert a method that will extract a single file from the ZIP archive (Based on its name)
您可以找到,如果有人发现这个有用,我可以清理它,添加代理,测试并建议拉入SSZipArchive。
You could find the modified version here, if someone finds this useful i might clean it up, add the delegate, the tests and propose for pull in SSZipArchive.
用法是直截了当:
NSString *zipEntityToExtract = @"example.aac";
NSString *destinationFilePath = ...; //(Includes filename)
NSString *zipPath = ...;
[SSZipArchive unzipEntityName:zipEntityToExtract fromFilePath:zipPath toDestination:filePath];
//File is now in destinationFilePath
这篇关于从Archive解压缩单个文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!