zipFile
压缩文件,生成zip包
import { MFileManager } from "@yl/super-jssdk"
MFileManager.zipFile(optional)
参数说明
| 参数 |
类型 |
必填 |
作用 |
| optional |
Object |
是 |
必填参数 |
optional
| 参数 |
类型 |
必填 |
作用 |
| path |
string |
是 |
zip文件的绝对路径 |
| files |
Array |
是 |
需要压缩的文件路径的数组 |
返回说明
| 参数 |
类型 |
作用 |
| resolve() |
Function |
执行成功 |
| reject(err) |
Function |
接口出错,err为详细错误信息,是一个json对象,例如:{"errCode":-1,"errMsg":"出错啦"} |
代码示例
MFileManager.zipFile({
path: 'file:///storage/emulated/0/Android/data/com.mysoft.smartengineertest/images/workbench-configs/cjap-icon',
files: ['file:///storage/emulated/0/Android/data/com.mysoft.smartengineertest/images/workbench-configs/cjap-icon/a.jpg']
}).then(() => {
console.log('文件压缩成功');
}).catch(err => {
console.error(err);
})