package.json 4.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. {
  2. "name": "cookie-parser",
  3. "description": "cookie parsing with signatures",
  4. "version": "1.3.4",
  5. "author": {
  6. "name": "TJ Holowaychuk",
  7. "email": "tj@vision-media.ca",
  8. "url": "http://tjholowaychuk.com"
  9. },
  10. "licenses": "MIT",
  11. "repository": {
  12. "type": "git",
  13. "url": "git://github.com/expressjs/cookie-parser"
  14. },
  15. "keywords": [
  16. "cookie",
  17. "middleware"
  18. ],
  19. "dependencies": {
  20. "cookie": "0.1.2",
  21. "cookie-signature": "1.0.6"
  22. },
  23. "devDependencies": {
  24. "istanbul": "0.3.5",
  25. "mocha": "~2.1.0",
  26. "supertest": "0.15.0"
  27. },
  28. "files": [
  29. "lib/",
  30. "LICENSE",
  31. "HISTORY.md",
  32. "index.js"
  33. ],
  34. "engines": {
  35. "node": ">= 0.8.0"
  36. },
  37. "scripts": {
  38. "test": "mocha --reporter spec --bail --check-leaks test/",
  39. "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/",
  40. "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/"
  41. },
  42. "readme": "# cookie-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\nParse `Cookie` header and populate `req.cookies` with an object keyed by the cookie\nnames. Optionally you may enable signed cookie support by passing a `secret` string,\nwhich assigns `req.secret` so it may be used by other middleware.\n\n## Installation\n\n```sh\n$ npm install cookie-parser\n```\n\n## API\n\n```js\nvar express = require('express')\nvar cookieParser = require('cookie-parser')\n\nvar app = express()\napp.use(cookieParser())\n```\n\n### cookieParser(secret, options)\n\n- `secret` a string used for signing cookies. This is optional and if not specified, will not parse signed cookies.\n- `options` an object that is passed to `cookie.parse` as the second option. See [cookie](https://www.npmjs.org/package/cookie) for more information.\n - `decode` a function to decode the value of the cookie\n\n### cookieParser.JSONCookie(str)\n\nParse a cookie value as a JSON cookie. This will return the parsed JSON value if it was a JSON cookie, otherwise it will return the passed value.\n\n### cookieParser.JSONCookies(cookies)\n\nGiven an object, this will iterate over the keys and call `JSONCookie` on each value. This will return the same object passed in.\n\n### cookieParser.signedCookie(str, secret)\n\nParse a cookie value as a signed cookie. This will return the parsed unsigned value if it was a signed cookie and the signature was valid, otherwise it will return the passed value.\n\n### cookieParser.signedCookies(cookies, secret)\n\nGiven an object, this will iterate over the keys and check if any value is a signed cookie. If it is a signed cookie and the signature is valid, the key will be deleted from the object and added to the new object that is returned.\n\n## Example\n\n```js\nvar express = require('express')\nvar cookieParser = require('cookie-parser')\n\nvar app = express()\napp.use(cookieParser())\n\napp.get('/', function(req, res) {\n console.log(\"Cookies: \", req.cookies)\n})\n\napp.listen(8080)\n\n// curl command that sends an HTTP request with two cookies\n// curl http://127.0.0.1:8080 --cookie \"Cho=Kim;Greet=Hello\"\n```\n\n### [MIT Licensed](LICENSE)\n\n[npm-image]: https://img.shields.io/npm/v/cookie-parser.svg\n[npm-url]: https://npmjs.org/package/cookie-parser\n[travis-image]: https://img.shields.io/travis/expressjs/cookie-parser/master.svg\n[travis-url]: https://travis-ci.org/expressjs/cookie-parser\n[coveralls-image]: https://img.shields.io/coveralls/expressjs/cookie-parser/master.svg\n[coveralls-url]: https://coveralls.io/r/expressjs/cookie-parser?branch=master\n[downloads-image]: https://img.shields.io/npm/dm/cookie-parser.svg\n[downloads-url]: https://npmjs.org/package/cookie-parser\n",
  43. "readmeFilename": "README.md",
  44. "bugs": {
  45. "url": "https://github.com/expressjs/cookie-parser/issues"
  46. },
  47. "homepage": "https://github.com/expressjs/cookie-parser",
  48. "_id": "cookie-parser@1.3.4",
  49. "_shasum": "193035a5be97117a21709b3aa737f6132717bda6",
  50. "_from": "cookie-parser@^1.3.2",
  51. "_resolved": "https://registry.npmjs.org/cookie-parser/-/cookie-parser-1.3.4.tgz"
  52. }