file-download
Version:
Generic file downloader
38 lines (24 loc) • 794 B
Markdown
`npm install file-download --save`
```
var download = require('file-download')
var url = "http://i.imgur.com/G9bDaPH.jpg"
var options = {
directory: "./images/cats/",
filename: "cat.gif"
}
download(url, options, function(err){
if (err) throw err
console.log("meow")
})
```
- __directory__ string with path to directory where to save files (default: current working directory)
- __filename__ string for the name of the file to be saved as (default: filename in the url)
- __timeout__ integer of how long in ms to wait while downloading (default: 20000)
###### __callback__ function to run after