Express middleware to monitor the bandwidth of requests.
Limitations:
-
If you use a reverse proxy that does compression / TLS termination, the bandwidth will not reflect that.
-
The bandwidth figure doesn't currently include HTTP headers, only request/response body.
npm install --save express-bandwidth express-transform
import transform from 'express-transform';
import bandwidth from 'express-bandwidth';
app.use(transform());
app.use(bandwidth((bw) => {
console.log(bw.incoming);
console.log(bw.outgoing);
}));