6***@qq.com
6***@qq.com
  • 发布:2019-06-21 15:28
  • 更新:2020-07-18 19:16
  • 阅读:1205

H5 plus 解压出现失败的情况

分类:HTML5+

为什么我这边解压缩会出现报错{code:"2",message:"L\MALFORMED[1]“}的情况

2019-06-21 15:28 负责人:无 分享
已邀请:
willy2358

willy2358 - 干就完了

 同问, 我的代码:

plus.io.requestFileSystem(plus.io.PRIVATE_DOC,   
    function(entry){  
        entry.root.getFile('newDir/download.zip', {create:false},  
            function(fileEntry) {  
                console.log('file found');  
                plus.zip.decompress(fileEntry.fullPath, '_doc/newDir/unzip2',  
                    function() {  
                        console.log("Decompress success!");  
                    },  
                    function(error) {  
                        console.log(error);  
                    }  
                );  
            },  
            function(error) {  
                console.log(error);  
            }  
        );  
    },  
    function(error){  
        console.log(error);  
    }  
);

调试输出:

19:13:45.951 file found at pages/index/index.vue:199  
19:13:46.064 [Object] {"code":2,"message":"error in opening zip file"}  at pages/index/index.vue:210
willy2358

willy2358 - 干就完了

我的原因是那个压缩包损坏了, 亲测下面的代码在Android下可顺利执行

let zip = "_doc/newDir/download.zip";  

plus.zip.decompress(zip, '_doc/newDir/03',function() {  
        console.log("Decompress success!");  
    },  
    function(error) {  
    console.log(error);  
});

输出:
Decompress success! at pages/index/index.vue:196

  • JJ212

    大佬 你最后的结论是压缩包损坏了 那你是怎么测才得出来的结论 难道是换一个压缩包?

    2021-12-15 16:04

1***@qq.com

1***@qq.com - 111

请问楼主,最后你的那个问题是咋们解决的?有的安卓系统,有的安卓系统不可用,求解决方案?

该问题目前已经被锁定, 无法添加新回复