-
-
Save minwe/6116e7ffd79092aeb627 to your computer and use it in GitHub Desktop.
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 http = require('http'); | |
var request = http.request({method: 'get', host: 'images.google.com', port: 80, path: '/intl/en_ALL/images/logos/images_logo_lg.gif'}, function(response) { | |
var data = []; | |
response.on('data', function(chunk) { | |
data.push(chunk); | |
}); | |
response.on('end', function() { | |
data = Buffer.concat(data, parseInt(response.headers['content-length']) || undefined); | |
require('fs').writeFileSync('./test.gif', data, 'binary'); | |
}); | |
}); | |
request.end(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment