/ Published in: JavaScript
// node stupidfb.js
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
var https = require('https') function GetFBUser(x) { return { host: 'graph.facebook.com', path: '/fql?' + encodeURI('q=select name from user where uid = ' + i) } } var N = process.argv.length > 2 ? process.argv[2] : 1000 loopme(N) function loopme(n) { var done = 0 var start = Date.now() for (var i = 0; i < n; i++) { https.get(GetFBUser(i), function(res) { // res.on('data', function(chunk) { console.log('BODY: ' + chunk) }); res.on('end', function() { if (++done == n) { console.log(n + ',' + (Date.now() - start) / 1000.0) } }); }); } }