Created
July 25, 2016 21:59
-
-
Save Lazhari/c6cb59fca786bd9588832ecb05574bb1 to your computer and use it in GitHub Desktop.
Downloading a file using the node module Request
This file contains hidden or 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
var fs = require('fs'), | |
request = require('request'); | |
function (url, path, callback) { | |
request({uri: url}) | |
.pipe(fs.createWriteStream(path)) | |
.on('close', function() { | |
callback(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment