Tutorial: Work with download manager

Work with download manager

Create a new download from a provided link:

stbDownloadManager.AddJob(url1, pathToSave1);

Create another download with operation status check:

if ( !stbDownloadManager.AddJob(url2, pathToSave2) ) {
    console.log('Was not able to create a job!');
}

Get all downloads general information and save jobs ids:

var queue  = JSON.parse(stbDownloadManager.GetQueueInfo()),
    job1Id = queue[0].id,
    job2Id = queue[1].id;

Stop file downloading:

stbDownloadManager.StopJob(job1Id);

Resume file downloading:

stbDownloadManage.StartJob(job1Id);

Change priority for given downloads:

// increase priority
stbDownloadManager.AdjustJobPriority(job1Id, true);
// decrease priority
stbDownloadManager.AdjustJobPriority(job2Id, false);

Remove a download from queue:

stbDownloadManager.DeleteJob(job2Id);

Insert another USB flash drive and restore all downloads using local catalog on selected device:

stbDownloadManager.RestoreJobs(mountPoint);