Skip to content

Instantly share code, notes, and snippets.

@minwe
Forked from ferlores/loadpng.js
Last active August 29, 2015 14:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save minwe/6116e7ffd79092aeb627 to your computer and use it in GitHub Desktop.
Save minwe/6116e7ffd79092aeb627 to your computer and use it in GitHub Desktop.
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