在React-Native上解压缩文件的任何方法 [英] Any way to unzip file on react-native
问题描述
设法将.zip文件下载到我的手机文件系统中.但是过了一会儿,我找不到一种方法来解压缩该文件.正如我尝试的那样:
Managed to download .zip file to my filesystem on mobile phone. But after a while realised I can't find a way how to unzip that file. As I tried with:
- https://github.com/plrthink/react-native-zip-archive
- https://github.com/remobile/react-native-zip
第一个在要求后立即死亡,并显示错误无法读取未定义的属性'unzip'"(请仔细按照说明进行操作)
First one dies immidiately after requiring, getting error "Cannot read property 'unzip' of undefined" (followed instructions carefully)
第二个之所以死亡,是因为它依赖于codrova端口来响应本机,这也行不通.
And the second one dies because it's dependant on codrova port to react native which also doesn't work.
是否有解决这些问题的建议或方法?
Any suggestions or way to solve these problems?
使用react-native 0.35,并在android 5.1.1.的Note4上进行测试.
Using react-native 0.35, testing on Note4 with android 5.1.1.
推荐答案
我确实设法解决了我的问题:
I did manage in the end solve my problem:
使用react-native-zip-archive
using react-native-zip-archive
解决方案是更改内部代码: 位于模块内部的RNZipArchiveModule.java文件
the solution was to change code inside: RNZipArchiveModule.java file which is inside module
需要应用的更改写在此注释中: https://github.com/plrthink/react- native-zip-archive/issues/14#issuecomment-261712319
The changes that needed to be applied are written in this comment: https://github.com/plrthink/react-native-zip-archive/issues/14#issuecomment-261712319
因此感谢胡九德洋解决问题.
So credits to hujiudeyang for solving problem.
这篇关于在React-Native上解压缩文件的任何方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!