damage
v0.0.6
Published
A simple way to calculate the 'damage' of running a task in Node.JS.
Downloads
6
Readme
damage
A simple way to calculate the damage a task in Node.JS.
Installation
$ npm install damage
Calculating the damage
Create a file requiring damage
and running damage()
.
Just like this:
var damageOf = require('damage');
var fs = require('fs');
// \/ Task's description
damageOf('reading a file',function (done) {
// Put the task here..
fs.readFile(__filename,done);
// /\ Function to be called when the task is done.
},1000);
// /\ How many times
Manipulating the result
You can intercept the result display and do what ever you want with it.
// Same code as before
var damageOf = require('damage');
var fs = require('fs');
damageOf('reading a file',function (done) {
fs.readFile(__filename,done);
},1000)
// Add \/ after the damage.
.is(function (result) {
fs.writeFile('output.log',result);
})