2021-10-22 18:35:24 +08:00
|
|
|
# zip-cordova-plugin
|
|
|
|
|
|
2021-10-22 18:48:31 +08:00
|
|
|
## 说明
|
|
|
|
|
|
|
|
|
|
用于将指定的文件列表压缩为一个zip文件
|
|
|
|
|
|
|
|
|
|
## 适用平台
|
|
|
|
|
|
|
|
|
|
+ android
|
|
|
|
|
+ ios
|
|
|
|
|
|
|
|
|
|
##安装方法
|
|
|
|
|
|
|
|
|
|
```shell
|
|
|
|
|
#cordova安装
|
|
|
|
|
cordova plugin add git+http://m.shuto.cn:8680/public/zip-cordova-plugin.git
|
|
|
|
|
|
|
|
|
|
#ionc安装
|
|
|
|
|
ionic cordova plugin add git+http://m.shuto.cn:8680/public/zip-cordova-plugin.git
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## 调用方法
|
|
|
|
|
|
|
|
|
|
```typescript
|
|
|
|
|
declare var zip;
|
|
|
|
|
|
|
|
|
|
try{
|
|
|
|
|
await new Promise<void>((resolve, reject) =>{
|
|
|
|
|
zip.zip(`/zip/file/path`,['item','path','array'], () => {
|
|
|
|
|
console.log('zip archive created');
|
|
|
|
|
resolve();
|
|
|
|
|
}, (error) => {
|
|
|
|
|
console.error('zip created error',error);
|
|
|
|
|
reject(error);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}catch (e){
|
|
|
|
|
console.error(error);
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|