diff --git a/src/@ionic-native/plugins/file-transfer/index.ts b/src/@ionic-native/plugins/file-transfer/index.ts index 0530d56d5..e48b41b46 100644 --- a/src/@ionic-native/plugins/file-transfer/index.ts +++ b/src/@ionic-native/plugins/file-transfer/index.ts @@ -1,8 +1,13 @@ import { Injectable } from '@angular/core'; -import { CordovaInstance, Plugin, InstanceCheck, checkAvailability, IonicNativePlugin } from '@ionic-native/core'; +import { + checkAvailability, + CordovaInstance, + InstanceCheck, + IonicNativePlugin, + Plugin +} from '@ionic-native/core'; export interface FileUploadOptions { - /** * The name of the form element. * Defaults to 'file'. @@ -30,7 +35,7 @@ export interface FileUploadOptions { /** * A set of optional key/value pairs to pass in the HTTP request. */ - params?: { [s: string]: any; }; + params?: { [s: string]: any }; /** * Whether to upload the data in chunked streaming mode. @@ -43,12 +48,10 @@ export interface FileUploadOptions { * than one value. On iOS, FireOS, and Android, if a header named * Content-Type is present, multipart form data will NOT be used. */ - headers?: { [s: string]: any; }; - + headers?: { [s: string]: any }; } export interface FileUploadResult { - /** * The number of bytes sent to the server as part of the upload. */ @@ -67,12 +70,10 @@ export interface FileUploadResult { /** * The HTTP response headers by the server. */ - headers: { [s: string]: any; }; - + headers: { [s: string]: any }; } export interface FileTransferError { - /** * One of the predefined error codes listed below. */ @@ -103,7 +104,6 @@ export interface FileTransferError { * Either e.getMessage or e.toString. */ exception: string; - } /** @@ -179,11 +179,18 @@ export interface FileTransferError { plugin: 'cordova-plugin-file-transfer', pluginRef: 'FileTransfer', repo: 'https://github.com/apache/cordova-plugin-file-transfer', - platforms: ['Amazon Fire OS', 'Android', 'Browser', 'iOS', 'Ubuntu', 'Windows', 'Windows Phone'] + platforms: [ + 'Amazon Fire OS', + 'Android', + 'Browser', + 'iOS', + 'Ubuntu', + 'Windows', + 'Windows Phone' + ] }) @Injectable() export class FileTransfer extends IonicNativePlugin { - /** * Error code rejected from upload with FileTransferError * Defined in FileTransferError. @@ -209,7 +216,6 @@ export class FileTransfer extends IonicNativePlugin { create(): FileTransferObject { return new FileTransferObject(); } - } /** @@ -223,7 +229,13 @@ export class FileTransferObject { private _objectInstance: any; constructor() { - if (checkAvailability(FileTransfer.getPluginRef(), null, FileTransfer.getPluginName()) === true) { + if ( + checkAvailability( + FileTransfer.getPluginRef(), + null, + FileTransfer.getPluginName() + ) === true + ) { this._objectInstance = new (FileTransfer.getPlugin())(); } } @@ -233,34 +245,48 @@ export class FileTransferObject { * * @param {string} fileUrl Filesystem URL representing the file on the device or a data URI. For backwards compatibility, this can also be the full path of the file on the device. * @param {string} url URL of the server to receive the file, as encoded by encodeURI(). - * @param {FileUploadOptions} options Optional parameters. - * @param {boolean} trustAllHosts Optional parameter, defaults to false. If set to true, it accepts all security certificates. This is useful since Android rejects self-signed security certificates. Not recommended for production use. Supported on Android and iOS. + * @param {FileUploadOptions} [options] Optional parameters. + * @param {boolean} [trustAllHosts] Optional parameter, defaults to false. If set to true, it accepts all security certificates. This is useful since Android rejects self-signed security certificates. Not recommended for production use. Supported on Android and iOS. * @returns {Promise} Returns a Promise that resolves to a FileUploadResult and rejects with FileTransferError. */ @CordovaInstance({ successIndex: 2, errorIndex: 3 }) - upload(fileUrl: string, url: string, options?: FileUploadOptions, trustAllHosts?: boolean): Promise { return; } + upload( + fileUrl: string, + url: string, + options?: FileUploadOptions, + trustAllHosts?: boolean + ): Promise { + return; + } /** * Downloads a file from server. * * @param {string} source URL of the server to download the file, as encoded by encodeURI(). * @param {string} target Filesystem url representing the file on the device. For backwards compatibility, this can also be the full path of the file on the device. - * @param {boolean} trustAllHosts Optional parameter, defaults to false. If set to true, it accepts all security certificates. This is useful because Android rejects self-signed security certificates. Not recommended for production use. Supported on Android and iOS. - * @param {object} Optional parameters, currently only supports headers (such as Authorization (Basic Authentication), etc). + * @param {boolean} [trustAllHosts] Optional parameter, defaults to false. If set to true, it accepts all security certificates. This is useful because Android rejects self-signed security certificates. Not recommended for production use. Supported on Android and iOS. + * @param {object} [Optional] parameters, currently only supports headers (such as Authorization (Basic Authentication), etc). * @returns {Promise} Returns a Promise that resolves to a FileEntry object. */ @CordovaInstance({ successIndex: 2, errorIndex: 3 }) - download(source: string, target: string, trustAllHosts?: boolean, options?: { [s: string]: any; }): Promise { return; } + download( + source: string, + target: string, + trustAllHosts?: boolean, + options?: { [s: string]: any } + ): Promise { + return; + } /** * Registers a listener that gets called whenever a new chunk of data is transferred. - * @param listener {function} Listener that takes a progress event. + * @param {Function} listener Listener that takes a progress event. */ @InstanceCheck({ sync: true }) onProgress(listener: (event: ProgressEvent) => any): void {