存储器中的Swift Zipfoundation Drestrate String不起作用
我在 https://github.com/weichub.com/weichelb.com/weichsel/zipfoundation
我的要求是UNZIP内存中的文件内容并直接转换为字符串。
let archive = Archive(url: fileUrl, accessMode: .read, preferredEncoding: .utf8)
do{
try archive?.extract(entry, consumer: {data in
print(data.count)
})
}catch{}
档案对象始终无读取zip文件。另外,要提取方法的输入对象是什么?
I am using ZipFoundation in Swift from https://github.com/weichsel/ZIPFoundation
My requirement is unzip the file contents in memory and directly convert into String.
let archive = Archive(url: fileUrl, accessMode: .read, preferredEncoding: .utf8)
do{
try archive?.extract(entry, consumer: {data in
print(data.count)
})
}catch{}
The archive object is always null its not reading zip file. Also what is the entry object to pass to extract method?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
邮政基础档案支持订阅。这允许您通过
archive
通过存档[“ path/to/to/file.txt”]
获得条目
。要访问获得的文件的内容,您可以使用
extract
的基于封闭的版本,如下所示:ZIP Foundation archives support subscripting. This allows you to obtain an
Entry
by subscripting into anArchive
viaarchive["path/to/file.txt"]
.To get access to the contents of the obtained file, you use the closure-based version of
extract
as follows: