Created
April 29, 2012 14:12
-
-
Save davidbanham/2550648 to your computer and use it in GitHub Desktop.
Failing to download a file with request
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
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