calculate transfer-rate of request/response
npm install transfer-rate




Calculate transfer-rate of request/response with different option for customization.
Build a function that, calculate ratio between data and time.
Install through NPM
``bash`
npm install transfer-rate`
orbash`
git clone git://github.com/hex7c0/transfer-rate.git
inside expressjs project
`js
var transfer = require('transfer-rate');
var app = require('express')();
var rate = transfer();
app.get('/', function(req, res) {
var start = process.hrtime();
res.send('ok');
console.log(transfer(req, res, start));
});
`
Calculation is store inside res and req Object and returned from function.`js`
req.transferRate
#### options
- data String Accepted string are related to http://en.wikipedia.org/wiki/Data_rate_units [Byte, KB, MB, bit, Kb, Mb] (default "KB")time
- - String Accepted string for calculate ratio are [nanosecond, millisecond, second] (default "second")response
- - Boolean Flag for calculate transfer rate of response(true) or request(false) (default "response")output
- - Boolean Flag for display(true) extra information like KB/s or only data(false) as string (default "display")
#### req
- req - Object Client request object (default "required")
#### res
- res - Object Client response object (default "required")
#### start
- start - Array High precision time, from process.hrtime()` (default "required")
Take a look at my examples
For chunked data, wait for a fix with event emitter https://github.com/hex7c0/transfer-rate/tree/master/examples/chunk_res.js or use on-finished module