Created
March 10, 2011 19:10
-
-
Save dudemeister/864690 to your computer and use it in GitHub Desktop.
nodejs agent/request 5 connections limit (?) when piping to file
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 fs = require('fs'); | |
var request = require('request'); | |
var parseUrl = require("url").parse; | |
var i = 100; | |
while(i > 0) { | |
r = request({"uri": parseUrl("http://farm4.static.flickr.com/3557/3670453345_c38d482efb_m.jpg", true), "maxSockets": 3}, function (error, response, body) { | |
console.log(i); | |
}) | |
r.pipe(fs.createWriteStream(i + ".jpg")) | |
i--; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment