import{Downloader}from'nativescript-downloader';Downloader.init();// <= Try calling this after the app launches to start the downloader serviceDownloader.setTimeout(120);//Increase timeout default 60s
varDownloader=require('nativescript-downloader').Downloader;Downloader.Downloader.init();// <= Try calling this after the app launches to start the downloader serviceDownloader.setTimeout(120);//Increase timeout default 60s
Creates a download task it returns the id of the task
getStatus(id: string)
StatusCode
Gets the status of a download task.
start(id: string, progress?: Function)
Promise<DownloadEventData>
Starts a download task.
resume(id: string)
void
Resumes a download task.
cancel(id: string)
void
Cancels a download task.
pause(id: string)
void
Pauses a download task.
getPath(id: string)
void
Return the path of a download task.
Example Image
IOS
Android
##Angular
Injection Root Component
import{Downloader}from'nativescript-downloader';
....ngOnInit(){Downloader.init();// <= Try calling this after the app launches to start the downloader service}
...
Custome Downloader option
// Request format for DownlaoderDownloadOptions{
url: string;
query?: Object|string;
headers?: Object;
path?: string;
fileName?: string;}