HarmonyOS 使用 zlib.decompressFile 会报错 17700101

HarmonyOS  使用 zlib.decompressFile 会报错 17700101

HarmonyOS
2024-08-12 14:48:23
浏览
收藏 0
回答 1
待解决
回答 1
按赞同
/
按时间
FengTianYa
// 参考demo如下可以实现成功解压 
function zlibDecompress() { 
  getContext().resourceManager.getRawFileContent('miniprogram2.zip', (_err, value) => { 
    let myBuffer:ArrayBufferLike = value.buffer 
    let context = getContext(); 
    //沙箱路径 
    let filePath = context.filesDir + "/miniprogram2.zip"; 
    console.log("testTag-filePath:" + filePath); 
    let file = fs.openSync(filePath, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE); 
    let writeLen = fs.writeSync(file.fd, myBuffer); 
    console.info("testTag-write data to file succeed and size is:" + writeLen); 
    fs.closeSync(file); 
    let inFile = getContext().filesDir + "/miniprogram2.zip"; 
    let outFileDir = getContext().filesDir; 
    let options: zlib.Options = { 
      level: zlib.CompressLevel.COMPRESS_LEVEL_DEFAULT_COMPRESSION 
    }; 
 
    try { 
      zlib.decompressFile(inFile, outFileDir, options, (errData: BusinessError) => { 
        if (errData !== null) { 
          console.error(`errData is errCode:${errData.code} message:${errData.message}`); 
        } 
      }) 
    } catch(errData) { 
      let code = (errData as BusinessError).code; 
      let message = (errData as BusinessError).message; 
      console.error(`errData is errCode:${code} message:${message}`); 
    } 
  }) 
}
分享
微博
QQ
微信
回复
2024-08-13 11:57:54
相关问题
zlib.decompressFile()解压报错如何分析
1800浏览 • 1回复 待解决
Checkstyle插件使用中为什么会报错
8256浏览 • 1回复 已解决
mysqldump导出oceanbase的表会报错
4548浏览 • 1回复 待解决
首选项存储问题,为什么会报错
172浏览 • 1回复 待解决
卸载重新安装时候,mmkv会报错
991浏览 • 1回复 待解决
如何在ets中引入zlib.js?
2481浏览 • 1回复 待解决
HarmonyOS 使用Proxy语法报错
385浏览 • 1回复 待解决