Skip to content

Instantly share code, notes, and snippets.

@mikeal
Created March 10, 2011 19:27
Show Gist options
  • Save mikeal/864727 to your computer and use it in GitHub Desktop.
Save mikeal/864727 to your computer and use it in GitHub Desktop.
var http = require('http');
var fs = require('fs');
var parseUrl = require('url').parse;
var i = 100;
while(i > 0) {
(function () {
var x = i;
var u = parseUrl("http://farm4.static.flickr.com/3557/3670453345_c38d482efb_m.jpg")
var c = http.request(
{ host:u.hostname
, port:u.port
, method: 'GET'
, path: u.pathname
, headers: {host:u.hostname}
}
, function (res) {
console.log(x)
res.pipe(fs.createWriteStream(x + ".jpg"))
})
c.end();
i--;
})()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment