{"name":"response-time","description":"Response time for Node.js servers","version":"2.3.4","author":{"name":"Jonathan Ong","email":"me@jongleberry.com","url":"http://jongleberry.com"},"contributors":[{"name":"Douglas Christopher Wilson","email":"doug@somethingdoug.com"}],"license":"MIT","keywords":["http","res","response time","x-response-time"],"repository":{"type":"git","url":"git+https://github.com/expressjs/response-time.git"},"dependencies":{"depd":"~2.0.0","on-headers":"~1.1.0"},"devDependencies":{"after":"0.8.2","eslint":"4.19.1","eslint-config-standard":"11.0.0","eslint-plugin-import":"2.32.0","eslint-plugin-markdown":"1.0.2","eslint-plugin-node":"6.0.1","eslint-plugin-promise":"3.8.0","eslint-plugin-standard":"3.1.0","mocha":"6.2.3","nyc":"14.1.1","supertest":"1.1.0"},"engines":{"node":">= 0.8.0"},"scripts":{"lint":"eslint --plugin markdown --ext js,md .","test":"mocha --reporter spec","test-ci":"nyc --reporter=lcovonly --reporter=text npm test","test-cov":"nyc --reporter=html --reporter=text npm test"},"_id":"response-time@2.3.4","gitHead":"81090b8293cade5e4d9a9cd5a6536d19b4530762","bugs":{"url":"https://github.com/expressjs/response-time/issues"},"homepage":"https://github.com/expressjs/response-time#readme","_nodeVersion":"22.10.0","_npmVersion":"10.9.0","dist":{"integrity":"sha512-fiyq1RvW5/Br6iAtT8jN1XrNY8WPu2+yEypLbaijWry8WDZmn12azG9p/+c+qpEebURLlQmqCB8BNSu7ji+xQQ==","shasum":"a42e757c8d8147b7fbe68fc51a507b1f9a734e2c","tarball":"http://registry-npm.ywwl.com/response-time/download/response-time-2.3.4.tgz","fileCount":5,"unpackedSize":9480,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIEs3z6ADSKsCNaIm0YV6cEcx/50yUMSWDtHMbIU2BIVhAiEA53okcVzAUZ2JT0G7s/4YrpProyizJCJ4aqQA4EHAJzA="}],"size":3955,"noattachment":false,"key":"/response-time/-/response-time-2.3.4.tgz"},"_npmUser":{"name":"ulisesgascon","email":"ulisesgascondev@gmail.com"},"directories":{},"maintainers":[{"name":"dougwilson","email":"doug@somethingdoug.com"},{"name":"ulisesgascon","email":"ulisesgascondev@gmail.com"},{"name":"fishrock123","email":"fishrock123@rocketmail.com"},{"name":"tjholowaychuk","email":"tj@vision-media.ca"},{"name":"jongleberry","email":"jonathanrichardong@gmail.com"},{"name":"defunctzombie","email":"shtylman@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/response-time_2.3.4_1752774317951_0.3802568670151787"},"_hasShrinkwrap":false,"readme":"# response-time\n\n[![NPM Version][npm-version-image]][npm-url]\n[![NPM Downloads][npm-downloads-image]][npm-url]\n[![Node.js Version][node-image]][node-url]\n[![Build Status][ci-image]][ci-url]\n[![Test Coverage][coveralls-image]][coveralls-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\nThis is a [Node.js](https://nodejs.org/en/) module available through the\n[npm registry](https://www.npmjs.com/). Installation is done using the\n[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):\n\n```sh\n$ npm install response-time\n```\n\n## API\n\n<!-- eslint-disable no-unused-vars -->\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)`](#responsetimefn).\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-version-image]: https://badgen.net/npm/v/response-time\n[npm-url]: https://npmjs.org/package/response-time\n[npm-downloads-image]: https://badgen.net/npm/dm/response-time\n[node-image]: https://badgen.net/npm/node/response-time\n[node-url]: https://nodejs.org/en/download\n[ci-image]: https://badgen.net/github/checks/express/response-time/master?label=ci\n[ci-url]: https://github.com/express/response-time/actions/workflows/ci.yml\n[coveralls-image]: https://badgen.net/coveralls/c/github/express/response-time/master\n[coveralls-url]: https://coveralls.io/r/express/response-time?branch=master\n","publish_time":1752774318110,"_cnpm_publish_time":1752774318110,"dist-tags":{"latest":"2.3.4"}}