{ "_args": [ [ { "raw": "response-time@~2.3.1", "scope": null, "escapedName": "response-time", "name": "response-time", "rawSpec": "~2.3.1", "spec": ">=2.3.1 <2.4.0", "type": "range" }, "/home/jdaugherty/work/GT2/GT2-Android/node_modules/connect" ] ], "_from": "response-time@>=2.3.1 <2.4.0", "_id": "response-time@2.3.2", "_inCache": true, "_location": "/response-time", "_npmOperationalInternal": { "host": "packages-18-east.internal.npmjs.com", "tmp": "tmp/response-time-2.3.2.tgz_1479259984678_0.6870394593570381" }, "_npmUser": { "name": "dougwilson", "email": "doug@somethingdoug.com" }, "_npmVersion": "1.4.28", "_phantomChildren": {}, "_requested": { "raw": "response-time@~2.3.1", "scope": null, "escapedName": "response-time", "name": "response-time", "rawSpec": "~2.3.1", "spec": ">=2.3.1 <2.4.0", "type": "range" }, "_requiredBy": [ "/connect" ], "_resolved": "https://registry.npmjs.org/response-time/-/response-time-2.3.2.tgz", "_shasum": "ffa71bab952d62f7c1d49b7434355fbc68dffc5a", "_shrinkwrap": null, "_spec": "response-time@~2.3.1", "_where": "/home/jdaugherty/work/GT2/GT2-Android/node_modules/connect", "author": { "name": "Jonathan Ong", "email": "me@jongleberry.com", "url": "http://jongleberry.com" }, "bugs": { "url": "https://github.com/expressjs/response-time/issues" }, "contributors": [ { "name": "Douglas Christopher Wilson", "email": "doug@somethingdoug.com" } ], "dependencies": { "depd": "~1.1.0", "on-headers": "~1.0.1" }, "description": "Response time for Node.js servers", "devDependencies": { "after": "0.8.2", "eslint": "3.10.1", "eslint-config-standard": "6.2.1", "eslint-plugin-promise": "3.3.2", "eslint-plugin-standard": "2.0.1", "istanbul": "0.4.5", "mocha": "2.5.3", "supertest": "1.1.0" }, "directories": {}, "dist": { "shasum": "ffa71bab952d62f7c1d49b7434355fbc68dffc5a", "tarball": "https://registry.npmjs.org/response-time/-/response-time-2.3.2.tgz" }, "engines": { "node": ">= 0.8.0" }, "files": [ "LICENSE", "HISTORY.md", "index.js" ], "gitHead": "34c40bc97bcd7e54e13b33f77ee231ca2032de6c", "homepage": "https://github.com/expressjs/response-time#readme", "keywords": [ "http", "res", "response time", "x-response-time" ], "license": "MIT", "maintainers": [ { "name": "defunctzombie", "email": "shtylman@gmail.com" }, { "name": "dougwilson", "email": "doug@somethingdoug.com" }, { "name": "fishrock123", "email": "fishrock123@rocketmail.com" }, { "name": "jongleberry", "email": "jonathanrichardong@gmail.com" }, { "name": "mscdex", "email": "mscdex@mscdex.net" }, { "name": "tjholowaychuk", "email": "tj@vision-media.ca" } ], "name": "response-time", "optionalDependencies": {}, "readme": "# response-time\n\n[![NPM Version][npm-image]][npm-url]\n[![NPM Downloads][downloads-image]][downloads-url]\n[![Build Status][travis-image]][travis-url]\n[![Test Coverage][coveralls-image]][coveralls-url]\n[![Gratipay][gratipay-image]][gratipay-url]\n\nResponse time for Node.js servers.\n\nThis module creates a middleware that records the response time for\nrequests in HTTP servers. The \"response time\" is defined here as the\nelapsed time from when a request enters this middleware to when the\nheaders are written out to the client.\n\n## Installation\n\n```sh\n$ npm install response-time\n```\n\n## API\n\n```js\nvar responseTime = require('response-time')\n```\n\n### responseTime([options])\n\nCreate a middleware that adds a `X-Response-Time` header to responses. If\nyou don't want to use this module to automatically set a header, please\nsee the section about [`responseTime(fn)`](#responsetimeoptions).\n\n#### Options\n\nThe `responseTime` function accepts an optional `options` object that may\ncontain any of the following keys:\n\n##### digits\n\nThe fixed number of digits to include in the output, which is always in\nmilliseconds, defaults to `3` (ex: `2.300ms`).\n\n##### header\n\nThe name of the header to set, defaults to `X-Response-Time`.\n\n##### suffix\n\nBoolean to indicate if units of measurement suffix should be added to\nthe output, defaults to `true` (ex: `2.300ms` vs `2.300`).\n\n### responseTime(fn)\n\nCreate a new middleware that records the response time of a request and\nmakes this available to your own function `fn`. The `fn` argument will be\ninvoked as `fn(req, res, time)`, where `time` is a number in milliseconds.\n\n## Examples\n\n### express/connect\n\n```js\nvar express = require('express')\nvar responseTime = require('response-time')\n\nvar app = express()\n\napp.use(responseTime())\n\napp.get('/', function (req, res) {\n res.send('hello, world!')\n})\n```\n\n### vanilla http server\n\n```js\nvar finalhandler = require('finalhandler')\nvar http = require('http')\nvar responseTime = require('response-time')\n\n// create \"middleware\"\nvar _responseTime = responseTime()\n\nhttp.createServer(function (req, res) {\n var done = finalhandler(req, res)\n _responseTime(req, res, function (err) {\n if (err) return done(err)\n\n // respond to request\n res.setHeader('content-type', 'text/plain')\n res.end('hello, world!')\n })\n})\n```\n\n### response time metrics\n\n```js\nvar express = require('express')\nvar responseTime = require('response-time')\nvar StatsD = require('node-statsd')\n\nvar app = express()\nvar stats = new StatsD()\n\nstats.socket.on('error', function (error) {\n console.error(error.stack)\n})\n\napp.use(responseTime(function (req, res, time) {\n var stat = (req.method + req.url).toLowerCase()\n .replace(/[:\\.]/g, '')\n .replace(/\\//g, '_')\n stats.timing(stat, time)\n}))\n\napp.get('/', function (req, res) {\n res.send('hello, world!')\n})\n```\n\n## License\n\n[MIT](LICENSE)\n\n[npm-image]: https://img.shields.io/npm/v/response-time.svg\n[npm-url]: https://npmjs.org/package/response-time\n[travis-image]: https://img.shields.io/travis/expressjs/response-time/master.svg\n[travis-url]: https://travis-ci.org/expressjs/response-time\n[coveralls-image]: https://img.shields.io/coveralls/expressjs/response-time/master.svg\n[coveralls-url]: https://coveralls.io/r/expressjs/response-time?branch=master\n[downloads-image]: https://img.shields.io/npm/dm/response-time.svg\n[downloads-url]: https://npmjs.org/package/response-time\n[gratipay-image]: https://img.shields.io/gratipay/dougwilson.svg\n[gratipay-url]: https://www.gratipay.com/dougwilson/\n", "readmeFilename": "README.md", "repository": { "type": "git", "url": "git+https://github.com/expressjs/response-time.git" }, "scripts": { "lint": "eslint .", "test": "mocha --reporter spec --bail --check-leaks test/", "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/", "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/" }, "version": "2.3.2" }