Class: FileTransfer

FileTransfer

new FileTransfer()

FileTransfer uploads a file to a remote server.

Methods

abort()

Aborts the ongoing file transfer on this object. The original error callback for the file transfer will be called if necessary.

download(source, target, successCallback, errorCallback, trustAllHosts, options)

Downloads a file form a given URL and saves it to the specified directory.
Parameters:
Name Type Description
source String URL of the server to receive the file
target String Full path of the file on the device
successCallback (Function} Callback to be invoked when upload has completed
errorCallback function Callback to be invoked upon error
trustAllHosts Boolean Optional trust all hosts (e.g. for self-signed certs), defaults to false
options FileDownloadOptions Optional parameters such as headers

upload(filePath, server, successCallback, errorCallback, options, trustAllHosts)

Given an absolute file path, uploads a file on the device to a remote server using a multipart HTTP request.
Parameters:
Name Type Description
filePath String Full path of the file on the device
server String URL of the server to receive the file
successCallback (Function} Callback to be invoked when upload has completed
errorCallback function Callback to be invoked upon error
options FileUploadOptions Optional parameters such as file name and mimetype
trustAllHosts Boolean Optional trust all hosts (e.g. for self-signed certs), defaults to false