{
  "name": "body-parser",
  "description": "Node.js body parsing middleware",
  "version": "1.8.4",
  "contributors": [
    {
      "name": "Douglas Christopher Wilson",
      "email": "doug@somethingdoug.com"
    },
    {
      "name": "Jonathan Ong",
      "email": "me@jongleberry.com",
      "url": "http://jongleberry.com"
    }
  ],
  "license": "MIT",
  "repository": {
    "type": "git",
    "url": "git://github.com/expressjs/body-parser"
  },
  "dependencies": {
    "bytes": "1.0.0",
    "depd": "0.4.5",
    "iconv-lite": "0.4.4",
    "media-typer": "0.3.0",
    "on-finished": "2.1.0",
    "qs": "2.2.4",
    "raw-body": "1.3.0",
    "type-is": "~1.5.1"
  },
  "devDependencies": {
    "istanbul": "0.3.2",
    "mocha": "~1.21.4",
    "should": "~4.0.4",
    "supertest": "~0.13.0"
  },
  "files": [
    "lib/",
    "LICENSE",
    "HISTORY.md",
    "index.js"
  ],
  "engines": {
    "node": ">= 0.8"
  },
  "scripts": {
    "test": "mocha --require should --require test/support/env --reporter spec --check-leaks --bail test/",
    "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --require test/support/env --reporter dot --check-leaks test/",
    "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --require test/support/env --reporter spec --check-leaks test/"
  },
  "readme": "# body-parser\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\nNode.js body parsing middleware.\n\nThis does not handle multipart bodies, due to their complex and typically large nature. For multipart bodies, you may be interested in the following modules:\n\n- [busboy](https://www.npmjs.org/package/busboy#readme) and [connect-busboy](https://www.npmjs.org/package/connect-busboy#readme)\n- [multiparty](https://www.npmjs.org/package/multiparty#readme) and [connect-multiparty](https://www.npmjs.org/package/connect-multiparty#readme)\n- [formidable](https://www.npmjs.org/package/formidable#readme)\n- [multer](https://www.npmjs.org/package/multer#readme)\n\nOther body parsers you might be interested in:\n\n- [body](https://www.npmjs.org/package/body#readme)\n- [co-body](https://www.npmjs.org/package/co-body#readme)\n\n## Installation\n\n```sh\n$ npm install body-parser\n```\n\n## API\n\n```js\nvar bodyParser = require('body-parser')\n```\n\n### bodyParser.json(options)\n\nReturns middleware that only parses `json`. This parser accepts any Unicode encoding of the body and supports automatic inflation of `gzip` and `deflate` encodings.\n\nThe options are:\n\n- `strict` - only parse objects and arrays. (default: `true`)\n- `inflate` - if deflated bodies will be inflated. (default: `true`)\n- `limit` - maximum request body size. (default: `<100kb>`)\n- `reviver` - passed to `JSON.parse()`\n- `type` - request content-type to parse (default: `json`)\n- `verify` - function to verify body content\n\nThe `type` argument is passed directly to the [type-is](https://www.npmjs.org/package/type-is#readme) library. This can be an extension name (like `json`), a mime type (like `application/json`), or a mime time with a wildcard (like `*/json`).\n\nThe `verify` argument, if supplied, is called as `verify(req, res, buf, encoding)`, where `buf` is a `Buffer` of the raw request body and `encoding` is the encoding of the request. The parsing can be aborted by throwing an error.\n\nThe `reviver` argument is passed directly to `JSON.parse` as the second argument. You can find more information on this argument [in the MDN documentation about JSON.parse](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse#Example.3A_Using_the_reviver_parameter).\n\n### bodyParser.raw(options)\n\nReturns middleware that parses all bodies as a `Buffer`. This parser supports automatic inflation of `gzip` and `deflate` encodings.\n\nThe options are:\n\n- `inflate` - if deflated bodies will be inflated. (default: `true`)\n- `limit` - maximum request body size. (default: `<100kb>`)\n- `type` - request content-type to parse (default: `application/octet-stream`)\n- `verify` - function to verify body content\n\nThe `type` argument is passed directly to the [type-is](https://www.npmjs.org/package/type-is#readme) library. This can be an extension name (like `bin`), a mime type (like `application/octet-stream`), or a mime time with a wildcard (like `application/*`).\n\nThe `verify` argument, if supplied, is called as `verify(req, res, buf, encoding)`, where `buf` is a `Buffer` of the raw request body and `encoding` is the encoding of the request. The parsing can be aborted by throwing an error.\n\n### bodyParser.text(options)\n\nReturns middleware that parses all bodies as a string. This parser supports automatic inflation of `gzip` and `deflate` encodings.\n\nThe options are:\n\n- `defaultCharset` - the default charset to parse as, if not specified in content-type. (default: `utf-8`)\n- `inflate` - if deflated bodies will be inflated. (default: `true`)\n- `limit` - maximum request body size. (default: `<100kb>`)\n- `type` - request content-type to parse (default: `text/plain`)\n- `verify` - function to verify body content\n\nThe `type` argument is passed directly to the [type-is](https://www.npmjs.org/package/type-is#readme) library. This can be an extension name (like `txt`), a mime type (like `text/plain`), or a mime time with a wildcard (like `text/*`).\n\nThe `verify` argument, if supplied, is called as `verify(req, res, buf, encoding)`, where `buf` is a `Buffer` of the raw request body and `encoding` is the encoding of the request. The parsing can be aborted by throwing an error.\n\n### bodyParser.urlencoded(options)\n\nReturns middleware that only parses `urlencoded` bodies. This parser accepts only UTF-8 encoding of the body and supports automatic inflation of `gzip` and `deflate` encodings.\n\nThe options are:\n\n- `extended` - parse extended syntax with the [qs](https://www.npmjs.org/package/qs#readme) module. (default: `true`)\n- `inflate` - if deflated bodies will be inflated. (default: `true`)\n- `limit` - maximum request body size. (default: `<100kb>`)\n- `parameterLimit` - maximum number of parameters. (default: `1000`)\n- `type` - request content-type to parse (default: `urlencoded`)\n- `verify` - function to verify body content\n\nThe `extended` argument allows to choose between parsing the urlencoded data with the `querystring` library (when `false`) or the `qs` library (when `true`). The \"extended\" syntax allows for rich objects and arrays to be encoded into the urlencoded format, allowing for a JSON-like experience with urlencoded. For more information, please [see the qs library](https://www.npmjs.org/package/qs#readme).\n\nThe `parameterLimit` argument controls the maximum number of parameters that are allowed in the urlencoded data. If a request contains more parameters than this value, a 415 will be returned to the client.\n\nThe `type` argument is passed directly to the [type-is](https://www.npmjs.org/package/type-is#readme) library. This can be an extension name (like `urlencoded`), a mime type (like `application/x-www-form-urlencoded`), or a mime time with a wildcard (like `*/x-www-form-urlencoded`).\n\nThe `verify` argument, if supplied, is called as `verify(req, res, buf, encoding)`, where `buf` is a `Buffer` of the raw request body and `encoding` is the encoding of the request. The parsing can be aborted by throwing an error.\n\n### req.body\n\nA new `body` object containing the parsed data is populated on the `request` object after the middleware.\n\n## Examples\n\n### express/connect top-level generic\n\nThis example demonstrates adding a generic JSON and urlencoded parser as a top-level middleware, which will parse the bodies of all incoming requests. This is the simplest setup.\n\n```js\nvar express = require('express')\nvar bodyParser = require('body-parser')\n\nvar app = express()\n\n// parse application/x-www-form-urlencoded\napp.use(bodyParser.urlencoded({ extended: false }))\n\n// parse application/json\napp.use(bodyParser.json())\n\napp.use(function (req, res) {\n  res.setHeader('Content-Type', 'text/plain')\n  res.write('you posted:\\n')\n  res.end(JSON.stringify(req.body, null, 2))\n})\n```\n\n### express route-specific\n\nThis example demonstrates adding body parsers specifically to the routes that need them. In general, this is the most recommend way to use body-parser with express.\n\n```js\nvar express = require('express')\nvar bodyParser = require('body-parser')\n\nvar app = express()\n\n// create application/json parser\nvar jsonParser = bodyParser.json()\n\n// create application/x-www-form-urlencoded parser\nvar urlencodedParser = bodyParser.urlencoded({ extended: false })\n\n// POST /login gets urlencoded bodies\napp.post('/login', urlencodedParser, function (req, res) {\n  if (!req.body) return res.sendStatus(400)\n  res.send('welcome, ' + res.body.username)\n})\n\n// POST /api/users gets JSON bodies\napp.post('/api/users', jsonParser, function (req, res) {\n  if (!req.body) return res.sendStatus(400)\n  // create user in req.body\n})\n```\n\n### change content-type for parsers\n\nAll the parsers accept a `type` option which allows you to change the `Content-Type` that the middleware will parse.\n\n```js\n// parse various different custom JSON types as JSON\napp.use(bodyParser.json({ type: 'application/*+json' }))\n\n// parse some custom thing into a Buffer\napp.use(bodyParser.raw({ type: 'application/vnd.custom-type' }))\n\n// parse an HTML body into a string\napp.use(bodyParser.text({ type: 'text/html' }))\n```\n\n## License\n\n[MIT](LICENSE)\n\n[npm-image]: https://img.shields.io/npm/v/body-parser.svg?style=flat\n[npm-url]: https://npmjs.org/package/body-parser\n[travis-image]: https://img.shields.io/travis/expressjs/body-parser.svg?style=flat\n[travis-url]: https://travis-ci.org/expressjs/body-parser\n[coveralls-image]: https://img.shields.io/coveralls/expressjs/body-parser.svg?style=flat\n[coveralls-url]: https://coveralls.io/r/expressjs/body-parser?branch=master\n[downloads-image]: https://img.shields.io/npm/dm/body-parser.svg?style=flat\n[downloads-url]: https://npmjs.org/package/body-parser\n[gratipay-image]: https://img.shields.io/gratipay/dougwilson.svg?style=flat\n[gratipay-url]: https://www.gratipay.com/dougwilson/\n",
  "readmeFilename": "README.md",
  "bugs": {
    "url": "https://github.com/expressjs/body-parser/issues"
  },
  "_id": "body-parser@1.8.4",
  "_from": "body-parser@~1.8.1"
}
