UNPKG

download-pdf

Version:

Download PDF files

40 lines (26 loc) 845 B
# download-pdf ## Install ```shell npm install download-pdf --save ``` ## Usage ```js var download = require('download-pdf') var pdf = "http://apps.who.int/iris/bitstream/10665/137592/1/roadmapsitrep_7Nov2014_eng.pdf" var options = { directory: "./pdfs/ebola/", filename: "2014-11-7.pdf" } download(pdf, options, function(err){ if (err) throw err console.log("meow") }) ``` ## API ### download(url, [options], callback(err)) - __url__ string of the file URL to download - __options__ object with options - __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