Socket
Book a DemoInstallSign in
Socket

koa-response-length

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

koa-response-length

Calculate the length of a response

latest
Source
npmnpm
Version
1.2.0
Version published
Maintainers
1
Created
Source

koa-response-length

Emit events about response lenghts.

Example

var responseLength = require('koa-response-length');

app.use(responseLength());

app.use(function*(){
  this.body = someStream();
  // also works with strings, buffers, json etc
});

app.on('response', function(len, ctx){
  console.log('url: %s length: %s', ctx.url, len);
});

Installation

$ npm install koa-response-length

API

responseLength()

Create a middleware that makes the koa app emit response events whenever a response is done, passing both the total response length and it's koa context.

License

MIT

FAQs

Package last updated on 29 Jan 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts