danielnieto / electron-download-manager

Manage downloadItems from Electron's BrowserWindows without user interaction, allowing single file download and bulk downloading
MIT License
120 stars 50 forks source link

Add support for cancel (or pause?) #18

Closed ericpyle closed 6 years ago

ericpyle commented 6 years ago

See recent commit to https://github.com/sindresorhus/electron-dl/commit/cb20484c2d3c9e2ecdff40cc6e81a8afac51353e

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.)

ndelvalle commented 6 years ago

@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:

https://github.com/danielnieto/electron-download-manager/blob/2aec86d97a0cd7a75a94921524028992a43dbebb/index.js#L47-L49

danielnieto commented 6 years ago

Thanks @ndelvalle