zher52 2023-05-07 17:59:13 +08:00
parent 213a26730e
commit 2ccf618d47

View File

@ -0,0 +1,68 @@
/**
* This is a template for new plugin wrappers
*
* TODO:
* - Add/Change information below
* - Document usage (importing, executing main functionality)
* - Remove any imports that you are not using
* - Remove all the comments included in this template, EXCEPT the @Plugin wrapper docs and any other docs you added
* - Remove this note
*
*/
import { Injectable } from '@angular/core';
import { Plugin, Cordova, AwesomeCordovaNativePlugin } from '@awesome-cordova-plugins/core';
/**
* @name Shuto Zip
* @description
* This plugin does something
*
* @usage
* ```typescript
* import { ShutoZip } from '@awesome-cordova-plugins/shuto-zip';
*
*
* constructor(private shutoZip: ShutoZip) { }
*
* ...
*
*
* this.shutoZip.functionName('Hello', 123)
* .then((res: any) => console.log(res))
* .catch((error: any) => console.error(error));
*
* ```
*/
@Plugin({
pluginName: 'ShutoZip',
plugin: 'cordova-plugin-zip',
pluginRef: 'zip',
repo: 'https://m.shuto.cn:8681/public/zip-cordova-plugin.git',
platforms: ['Android', 'iOS'],
})
@Injectable()
export class Zip extends AwesomeCordovaNativePlugin {
/**
* Extracts files from a ZIP archive
* @param {string} sourceZip Source ZIP file
* @param {string} destFolder Destination folder
* @param {Function} onProgress optional callback to be called on progress update
* @returns {Promise<number>} returns a promise that resolves with a number. 0 is success, -1 is error
*/
@Cordova()
async unzip(sourceZip: string, destFolder: string, onProgress?: Function): Promise<number> {
return -2;
}
/**
* Extracts files from a ZIP archive
* @param {string} sourceZip Source ZIP file
* @param {string} destFolder Destination folder
* @param {Function} onProgress optional callback to be called on progress update
* @returns {Promise<number>} returns a promise that resolves with a number. 0 is success, -1 is error
*/
@Cordova()
async zip(sourceZip: string, list: string[], onProgress?: Function, onError?: Function): Promise<void> {
return;
}
}