Created
May 20, 2015 16:38
-
-
Save agreen757/41324563304cf330ce12 to your computer and use it in GitHub Desktop.
Downloading files using Request module in Node.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function downloader(url,title,token){ | |
var file = fs.createWriteStream(title); | |
var options = { | |
url: url, | |
headers: { | |
Authorization: 'Bearer '+token | |
} | |
} | |
request(options).pipe(file).on('close',function(){ | |
console.log('done') | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment