{ "_args": [ [ { "raw": "accepts@~1.3.3", "scope": null, "escapedName": "accepts", "name": "accepts", "rawSpec": "~1.3.3", "spec": ">=1.3.3 <1.4.0", "type": "range" }, "C:\\Users\\Giuliano\\Desktop\\nasaproject\\node_modules\\express" ] ], "_from": "accepts@>=1.3.3 <1.4.0", "_id": "accepts@1.3.3", "_inCache": true, "_location": "/accepts", "_nodeVersion": "4.4.3", "_npmOperationalInternal": { "host": "packages-16-east.internal.npmjs.com", "tmp": "tmp/accepts-1.3.3.tgz_1462251932032_0.7092335098423064" }, "_npmUser": { "name": "dougwilson", "email": "doug@somethingdoug.com" }, "_npmVersion": "2.15.1", "_phantomChildren": {}, "_requested": { "raw": "accepts@~1.3.3", "scope": null, "escapedName": "accepts", "name": "accepts", "rawSpec": "~1.3.3", "spec": ">=1.3.3 <1.4.0", "type": "range" }, "_requiredBy": [ "/express" ], "_resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.3.tgz", "_shasum": "c3ca7434938648c3e0d9c1e328dd68b622c284ca", "_shrinkwrap": null, "_spec": "accepts@~1.3.3", "_where": "C:\\Users\\Giuliano\\Desktop\\nasaproject\\node_modules\\express", "bugs": { "url": "https://github.com/jshttp/accepts/issues" }, "contributors": [ { "name": "Douglas Christopher Wilson", "email": "doug@somethingdoug.com" }, { "name": "Jonathan Ong", "email": "me@jongleberry.com", "url": "http://jongleberry.com" } ], "dependencies": { "mime-types": "~2.1.11", "negotiator": "0.6.1" }, "description": "Higher-level content negotiation", "devDependencies": { "istanbul": "0.4.3", "mocha": "~1.21.5" }, "directories": {}, "dist": { "shasum": "c3ca7434938648c3e0d9c1e328dd68b622c284ca", "tarball": "https://registry.npmjs.org/accepts/-/accepts-1.3.3.tgz" }, "engines": { "node": ">= 0.6" }, "files": [ "LICENSE", "HISTORY.md", "index.js" ], "gitHead": "3e925b1e65ed7da2798849683d49814680dfa426", "homepage": "https://github.com/jshttp/accepts#readme", "keywords": [ "content", "negotiation", "accept", "accepts" ], "license": "MIT", "maintainers": [ { "name": "dougwilson", "email": "doug@somethingdoug.com" } ], "name": "accepts", "optionalDependencies": {}, "readme": "# accepts\n\n[![NPM Version][npm-image]][npm-url]\n[![NPM Downloads][downloads-image]][downloads-url]\n[![Node.js Version][node-version-image]][node-version-url]\n[![Build Status][travis-image]][travis-url]\n[![Test Coverage][coveralls-image]][coveralls-url]\n\nHigher level content negotiation based on [negotiator](https://www.npmjs.com/package/negotiator). Extracted from [koa](https://www.npmjs.com/package/koa) for general use.\n\nIn addition to negotiator, it allows:\n\n- Allows types as an array or arguments list, ie `(['text/html', 'application/json'])` as well as `('text/html', 'application/json')`.\n- Allows type shorthands such as `json`.\n- Returns `false` when no types match\n- Treats non-existent headers as `*`\n\n## Installation\n\n```sh\nnpm install accepts\n```\n\n## API\n\n```js\nvar accepts = require('accepts')\n```\n\n### accepts(req)\n\nCreate a new `Accepts` object for the given `req`.\n\n#### .charset(charsets)\n\nReturn the first accepted charset. If nothing in `charsets` is accepted,\nthen `false` is returned.\n\n#### .charsets()\n\nReturn the charsets that the request accepts, in the order of the client's\npreference (most preferred first).\n\n#### .encoding(encodings)\n\nReturn the first accepted encoding. If nothing in `encodings` is accepted,\nthen `false` is returned.\n\n#### .encodings()\n\nReturn the encodings that the request accepts, in the order of the client's\npreference (most preferred first).\n\n#### .language(languages)\n\nReturn the first accepted language. If nothing in `languages` is accepted,\nthen `false` is returned.\n\n#### .languages()\n\nReturn the languages that the request accepts, in the order of the client's\npreference (most preferred first).\n\n#### .type(types)\n\nReturn the first accepted type (and it is returned as the same text as what\nappears in the `types` array). If nothing in `types` is accepted, then `false`\nis returned.\n\nThe `types` array can contain full MIME types or file extensions. Any value\nthat is not a full MIME types is passed to `require('mime-types').lookup`.\n\n#### .types()\n\nReturn the types that the request accepts, in the order of the client's\npreference (most preferred first).\n\n## Examples\n\n### Simple type negotiation\n\nThis simple example shows how to use `accepts` to return a different typed\nrespond body based on what the client wants to accept. The server lists it's\npreferences in order and will get back the best match between the client and\nserver.\n\n```js\nvar accepts = require('accepts')\nvar http = require('http')\n\nfunction app(req, res) {\n var accept = accepts(req)\n\n // the order of this list is significant; should be server preferred order\n switch(accept.type(['json', 'html'])) {\n case 'json':\n res.setHeader('Content-Type', 'application/json')\n res.write('{\"hello\":\"world!\"}')\n break\n case 'html':\n res.setHeader('Content-Type', 'text/html')\n res.write('hello, world!')\n break\n default:\n // the fallback is text/plain, so no need to specify it above\n res.setHeader('Content-Type', 'text/plain')\n res.write('hello, world!')\n break\n }\n\n res.end()\n}\n\nhttp.createServer(app).listen(3000)\n```\n\nYou can test this out with the cURL program:\n```sh\ncurl -I -H'Accept: text/html' http://localhost:3000/\n```\n\n## License\n\n[MIT](LICENSE)\n\n[npm-image]: https://img.shields.io/npm/v/accepts.svg\n[npm-url]: https://npmjs.org/package/accepts\n[node-version-image]: https://img.shields.io/node/v/accepts.svg\n[node-version-url]: http://nodejs.org/download/\n[travis-image]: https://img.shields.io/travis/jshttp/accepts/master.svg\n[travis-url]: https://travis-ci.org/jshttp/accepts\n[coveralls-image]: https://img.shields.io/coveralls/jshttp/accepts/master.svg\n[coveralls-url]: https://coveralls.io/r/jshttp/accepts\n[downloads-image]: https://img.shields.io/npm/dm/accepts.svg\n[downloads-url]: https://npmjs.org/package/accepts\n", "readmeFilename": "README.md", "repository": { "type": "git", "url": "git+https://github.com/jshttp/accepts.git" }, "scripts": { "test": "mocha --reporter spec --check-leaks --bail 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": "1.3.3" }