danielnieto/electron-download-manager

Add support for cancel (or pause?)

ericpyle opened this issue · 2 comments

See recent commit to sindresorhus/electron-dl@cb20484

Since your download manager tries to support resume, it's possible this cancel functionality could double as pause. (Truly canceling may require deleting the what has been downloaded upto the cancel.)

@ericpyle apparently the item is being send as a second argument in the onProgress function, so I think you should be able to call item.cancel(), take a look:

if (typeof queueItem.onProgress === 'function') {
queueItem.onProgress(progress, item);
}

Thanks @ndelvalle