DailyJS

Node Roundup: 0.10.17, Defining Global Scripts in npm, loadtest

Alex R. Young

Subscribe

@dailyjs

Facebook

Google+

node modules http npm benchmarking

Node Roundup: 0.10.17, Defining Global Scripts in npm, loadtest

Posted by Alex R. Young on .
Featured

node modules http npm benchmarking

Node Roundup: 0.10.17, Defining Global Scripts in npm, loadtest

Posted by Alex R. Young on .

Node 0.10.17

Node 0.10.17 is out, so it seems like we're back to weekly releases again. This version updates uv, tls, stream, dgram, and readline. The stream module fix makes errors raise exceptions when 'error' listeners are removed, which seems like a slight oversight to me...

Defining Global Scripts in npm

Joe Sullivan sent in his post about how global scripts are defined in popular npm modules. This is the kind of thing I like to see -- learning from the pros. Joe summarises the common approaches at the end of the post.

loadtest

loadtest (GitHub: alexfernandez / loadtest, License: MIT, npm: loadtest) by Alex Fernández is a load testing module inspired by and partly compatible with Apache ab. It can be invoked as a command-line script or used as a module.

var loadtest = require('loadtest');  
var options = {  
    url: 'http://localhost:8000',
    maxRequests: 1000,
};

loadtest.loadTest(options, function(error, result) {  
  if (error) {
    return console.error('Error:', error);
  }

  console.log('Tests run successfully');
});

The callback is run when the requests have been made, or the specified number of seconds have elapsed.