Download file from a given sourceUrl
to a targetPath
with wget
.
const download = require('@mborne/dl');
/*
* Note that a temp file `{targetPath}.part` is created while downloading to handle download interuptions
*/
const targetPath = await download({
sourceUrl: 'https://github.com/mborne.keys',
targetPath: '/tmp/mborne.keys'
});
Name | Required? | Description | Default |
---|---|---|---|
sourceUrl |
YES | Source URL (http, https, ftp) | NA |
targetPath |
YES | Input encoding (UTF-8, LATIN1,...) | NA |
downloadIfExists |
NO | Download file if targetPath exists? | true |
unsafeSsl |
NO | Disable certificate checking | false |