Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 43 lines (30 sloc) 825 Bytes
#!/usr/bin/env node
var argv = require('optimist').argv,
stream = require('stream'),
request = require('request');
var url = argv['_'][0],
concurrency = argv['c'],
array = [];
for (var i=0; i < concurrency; i++) {
array.push(i)
}
array.forEach(function(n) {
var mypulldata = new stream.Stream();
mypulldata.writable = true
mypulldata.write = function () {
// console.log(n,"chunk")
process.stdout.write('.')
}
mypulldata.end = function () {
console.log(n,"end")
};
mypulldata.on('error',function (error) {
console.log(n,"error", error)
});
var req = request({url:url, agent:false})
req.pipe(mypulldata);
req.on('error',function (error) {
console.log(n,"error", error)
});
console.log(n,'started')
});