函数:ts.unzip 文件解压(仅支持 iOS)

函数名称:文件解压

函数功能:文件解压,解压压缩包

支持版本:仅 ts.so v1.2.1 以上版本支持

函数方法

flag = ts.unzip(zipPath,filePath)

参数 类型 必填 说明
zipPath string 压缩包路径
filePath string 解压路径
返回值 类型 说明
flag boolean 成功返回 true,失败返回 false

函数用例

local ts = require("ts")
local root = userPath()
io.open(root .. "/res/1.txt","w"):write("测试"):close()
io.open(root .. "/res/2.txt","w"):write("测试"):close()
io.open(root .. "/res/3.txt","w"):write("还是测试"):close()
local fileList = {
    {root .. "/res/1.txt","1.txt"},
    {root .. "/res/2.txt","/file/2.txt"},
    {root .. "/res/3.txt","3.txt"}
}
ts.zip(root .. "/res/测试.zip",fileList)
zipPath = root .. "/res/测试.zip"
filePath = root .. "/res/解压"
flag = ts.unzip(zipPath,filePath)
if flag then
dialog("解压成功",3)
else
dialog("解压失败",3)
end

注意事项

  • 添加到压缩包的文件名是中文的情况下会导致文件名乱码,请使用英文文件名
Copyright 北京帮你玩科技有限公司 2023 all right reserved,powered by Gitbook该文章修订时间: 2024-03-06 17:50:18

results matching ""

    No results matching ""