Skip to content

Instantly share code, notes, and snippets.

@davidbanham
Created April 29, 2012 14:12
Show Gist options
  • Save davidbanham/2550648 to your computer and use it in GitHub Desktop.
Save davidbanham/2550648 to your computer and use it in GitHub Desktop.
Failing to download a file with request
var request = require('request');
var fs = require('fs');
var url = 'http://www.google.com/images/srpr/logo3w.png';
// for comparison, wget https://www.google.com/images/srpr/logo3w.png then diff logo3w.png nodeVersion.png
request({url: url}, function(error, response, body) {
if (error) callback(error);
else {
fs.writeFile('./nodeVersion.png', body, 'base64', function(err){
if(err) console.log(err);
else console.log('yay')
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment