LargeFileHelper

Tinode. LargeFileHelper

LargeFileHelper - collection of utilities for uploading and downloading files out of band. Don't instantiate this class directly. Use {Tinode.getLargeFileHelper} instead.

Constructor

new LargeFileHelper(tinode)

Source:
Parameters:
Name Type Description
tinode Tinode the main Tinode object.

Methods

cancel()

Try to cancel an ongoing upload or download.
Source:

download(relativeUrl, filenameopt) → {Promise}

Download the file from a given URL using GET request. This method works with the Tinode server only.
Source:
Parameters:
Name Type Attributes Description
relativeUrl String URL to download the file from. Must be relative url, i.e. must not contain the host.
filename String <optional>
file name to use for the downloaded file.
Returns:
Type:
Promise
resolved/rejected when the download is completed/failed.

getId() → {string}

Get unique id of this request.
Source:
Returns:
Type:
string
unique id

upload(data, onProgress, onSuccess, onFailure) → {Promise}

Start uploading the file to default endpoint.
Source:
Parameters:
Name Type Description
data File | Blob to upload
onProgress Callback callback. Takes one {float} parameter 0..1
onSuccess Callback callback. Called when the file is successfully uploaded.
onFailure Callback callback. Called in case of a failure.
Returns:
Type:
Promise
resolved/rejected when the upload is completed/failed.

uploadWithBaseUrl(baseUrl, data, onProgress, onSuccess, onFailure) → {Promise}

Start uploading the file to a non-default endpoint.
Source:
Parameters:
Name Type Description
baseUrl String alternative base URL of upload server.
data File | Blob to upload
onProgress Callback callback. Takes one {float} parameter 0..1
onSuccess Callback callback. Called when the file is successfully uploaded.
onFailure Callback callback. Called in case of a failure.
Returns:
Type:
Promise
resolved/rejected when the upload is completed/failed.