Downit simply downloads a file from a URL to a destination on the disk, resuming previous progress if the server supports the Range
header.
npm i downit
const downit = require('downit')
downit(url, dest, {
headers: { Authorization: 'Bearer Of Good News' },
onprogress: (got, total) => console.log('Got ', got, 'B of ', total, 'B'),
onrequest: req => { /* The node request instance */ },
onresponse: res => { /* The node response instance */ }
}).then(() => {
console.log('Downed it')
}).catch(e => {
console.error('Dropped it, due to ', e)
})
Downit also works on the command line.
npm i downit -g
downit url [dest]