收藏 分销(赏)

AppCan插件使用文档之uexZip.docx

上传人:xrp****65 文档编号:8972514 上传时间:2025-03-09 格式:DOCX 页数:6 大小:24.87KB 下载积分:10 金币
下载 相关 举报
AppCan插件使用文档之uexZip.docx_第1页
第1页 / 共6页
AppCan插件使用文档之uexZip.docx_第2页
第2页 / 共6页


点击查看更多>>
资源描述
uexZip对象封装了压缩 & 解压缩接口API. 使用示例 以下示例代码说明了如何使用uexZip对象的方法. <!DOCTYPE html> <html> <head> <title>AppCan API uexZip</title> <meta charset='utf-8'> </head> <body> <span>压缩</span><br/> <input type='button' value='zip' onclick='zip()'/><br/> <span>解压缩</span><br/> <input type='button' value='unZip' onclick='unZip()'/><br/> <span>加密压缩</span><br/> <input type='button' value='zipPass' onclick='zipPass('zywx')'/><br/> <span>加密解压缩</span><br/> <input type='button' value='unZipPass' onclick='unZipPass('zywx')'/><br/> </body> <script> var fileName = ''; window.uexOnload = function(type){ if(!type){ //uexZip.zip及uexZip.zipWithPassword压缩回调 uexZip.cbZip = function(opId,dataType,data){ if(dataType==2){ if(data==0){ alert('压缩成功!'); }else{ alert('压缩失败!'); } } } //uexZip.zip及uexZip.zipWithPassword解压缩回调 uexZip.cbUnZip = function(opId,dataType,data){ if(dataType==2){ if(data==0){ alert('解压缩成功!'); }else{ alert('解压缩失败!'); } } } } } /** * uexZip支持文件、文件夹绝对路径压缩 */ function zip(){ uexFileMgr.cbExplorer = function(opId,dataType,data){ if(dataType == 0){ fileName = data.substring(data.lastIndexOf('/')+1); uexZip.zip(data,'wgt://data/zipDemo.zip'); } } uexFileMgr.explorer(''); } /** * 未加密zip解压缩 */ function unZip(){ uexFileMgr.cbExplorer = function(opId, dataType, data){ if (dataType == 0) { uexZip.unzip(data, 'wgt://data/'); } } uexFileMgr.explorer(''); } /** * 加密压缩 * @param {Object} pass 加密密码 */ function zipPass(pass){ uexFileMgr.cbExplorer = function(opId,dataType,data){ if(dataType == 0){ fileName = data.substring(data.lastIndexOf('/')+1); uexZip.zipWithPassword(data,'wgt://data/zipPass.zip',pass); } } uexFileMgr.explorer(''); } /** * 解密解压缩 * @param {Object} pass 解密密码 */ function unZipPass(pass){ uexFileMgr.cbExplorer = function(opId, dataType, data){ if (dataType == 0) { uexZip.unzipWithPassword(data,'wgt://data/',pass); } } uexFileMgr.explorer(''); } </script> </html> Defined By Methods 1,uexZip zip (inSrcPath,inZippedPath) 压缩文件. Parameters inSrcPath 要压缩的文件或文件夹的路径。 inZippedPath 压缩后的zip文件。 2.uexZip cbZip (opId,dataType,data) uexZip.zip、uexZip.zipWithPassword的回调方法。 Parameters opId 操作ID,在此函数中不起作用,可忽略。 dataType 返回数据的数据类型为uex.cInt(值为2)。 data 返回的int型的数据,0代表成功或1代表失败。 3,uexZip zipWithPassword (inSrcPath,inZippedPath,inPassword) 加密压缩文件。 Parameters inSrcPath 要压缩的文件或文件夹的路径。 inZippedPath 压缩后的zip文件。 inPassword 压缩的密码。 4,uexZip unzip (inSrcPath,inZippedPath) 解压缩文件。 Parameters inSrcPath 要解压的文件路径。 inZippedPath 解压后的文件路径。 5,uexZip cbUnZip (opId,dataType,data) uexZip.unzip、uexZip.unzipWithPassWord的回调方法。 Parameters opId 操作ID,在此函数中不起作用,可忽略。 dataType 返回数据的数据类型为uex.cInt(值为2)。 data 返回的int型的数据,0代表成功或1代表失败。 6,uexZip unzipWithPassWord (inSrcPath,inZippedPath,inPassword) 加密解压缩文件。 Parameters inSrcPath 要解压的文件路径。 inZippedPath 解压后的文件路径。 inPassword 解压的密码。
展开阅读全文

开通  VIP会员、SVIP会员  优惠大
下载10份以上建议开通VIP会员
下载20份以上建议开通SVIP会员


开通VIP      成为共赢上传

当前位置:首页 > 包罗万象 > 大杂烩

移动网页_全站_页脚广告1

关于我们      便捷服务       自信AI       AI导航        抽奖活动

©2010-2026 宁波自信网络信息技术有限公司  版权所有

客服电话:0574-28810668  投诉电话:18658249818

gongan.png浙公网安备33021202000488号   

icp.png浙ICP备2021020529号-1  |  浙B2-20240490  

关注我们 :微信公众号    抖音    微博    LOFTER 

客服