Skip to content

Instantly share code, notes, and snippets.

@Lazhari
Created July 25, 2016 21:59
Show Gist options
  • Save Lazhari/c6cb59fca786bd9588832ecb05574bb1 to your computer and use it in GitHub Desktop.
Save Lazhari/c6cb59fca786bd9588832ecb05574bb1 to your computer and use it in GitHub Desktop.
Downloading a file using the node module Request
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