{"bugs":{"url":"https://github.com/fastify/fastify-static/issues"},"dist":{"shasum":"93f9f3874b6620e2e028819347925859b9ab17a5","tarball":"https://registry.npmjs.org/fastify-static/-/fastify-static-2.1.0.tgz","fileCount":17,"integrity":"sha512-KAeY3QrypqLiFib4ptuzT4NNpg9mzR4GBW+tFZ4HtgpBxbLCSs2e0/eCPCntyUAui5yxc5aITPTH4kcWfHgr2Q==","signatures":[{"sig":"MEYCIQDy+7oElchqnHz2CuCwY11hloWTS9bTSl3hpzHRxzbNmgIhANB4o0u/+NJBQxoCuD0EBfxT6I4iOUsjSdjFBXGO5sqC","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":43440,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcMN2/CRA9TVsSAnZWagAADikP/1e9Ic2THRPjX02M25E0\nPF6YXR0v7jgaGfJ5KtT4lCR1RhuBAgd3RM0cISwgyWt8UIuiLugENKUoTrM3\nRJgxL3Jwypm9/7RReLD6ZXJ5GNH9vUchgplmmIbZIbBtFCgrsAcWd2FyAnGz\nggJNFAhmo2CdtV37Ip/sciWWAGC+sZ4x8lhx163m4KDjm3KKvmCHnlFdNJ9T\nNPbLbozANA71VicbsgFPYtg0GW09lyQ6P/K9UQZ8Ww2H3iOQlTMwYIKbW1Nk\nc6dfNVEdrlaLRWiXClr4uTHYUvcqdO9RoiX6QWiCkybKlHBiq03x648Utv/C\nM1ynZiRB96+Pc623iss1ImLxQ9BAgO7jax/4bSTyd6dP3/OkdMkh9x6LAynT\nC818uoEH9eXwUkoPPu7U15rHTRbkC1QOH2uznAs2XogsyR/RKwlchWHr2L6g\nIi0w2yniD+WjnZ7l6l0XtaRgsBDd+xl2wtWpbZPgdYLsYII6u6ljDh7HBe8V\nBNz8ay//sk72JkfjMBhqZqqYdg5opogbNSqrB3jMUKgc/cl0NF8GZKH69zYo\nnKqpsAn57Up3aHTh58XVnI9WRv/GWxdJ5WmsMYbKTN1d1fROnNJM8qTK9lR0\nazFC+l7Vgc1KrzjJIBsuWMcVdlVWfV7aVjQImkWhRTEXiFKSwEETcF8yFfTU\nFII3\r\n=DASs\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","name":"fastify-static","author":{"name":"Tommaso Allevi - @allevo"},"readme":"# fastify-static\n[![Build Status](https://travis-ci.org/fastify/fastify-static.svg?branch=master)](https://travis-ci.org/fastify/fastify-static) [![Greenkeeper badge](https://badges.greenkeeper.io/fastify/fastify-static.svg)](https://greenkeeper.io/) [![Known Vulnerabilities](https://snyk.io/test/github/fastify/fastify-static/badge.svg)](https://snyk.io/test/github/fastify/fastify-static)\n\nPlugin for serving static files as fast as possible. Supports Fastify versions `>=2.0.0`. \n\nPlease refer to [this branch](https://github.com/fastify/fastify-static/tree/1.x) and related versions for Fastify `^1.11.0` compatibility.\n\n## Install\n\n`npm install --save fastify-static`\n\n## Usage\n\n```js\nconst fastify = require('fastify')()\nconst path = require('path')\n\nfastify.register(require('fastify-static'), {\n  root: path.join(__dirname, 'public'),\n  prefix: '/public/', // optional: default '/'\n})\n\nfastify.get('/another/path', function (req, reply) {\n  reply.sendFile('myHtml.html') // serving path.join(__dirname, 'public', 'myHtml.html') directly\n})\n\n```\n\n### Options\n\n#### `root` (required)\n\nThe absolute path of the directory that contains the files to serve.\nThe file to serve will be determined by combining `req.url` with the\nprovided root directory.\n\n#### `prefix`\n\nDefault: `'/'`\n\nA URL path prefix used to create a virtual mount path for the static directory.\n\n#### `schemaHide`\n\nDefault: `true`\n\nA flag that define if the fastify route hide-schema attribute is hidden or not\n\n#### `setHeaders`\n\nDefault: `undefined`\n\nA function to set custom headers on the response. Alterations to the headers\nmust be done synchronously. The function is called as `fn(res, path, stat)`,\nwhere the arguments are:\n\n- `res` The response object.\n- `path` The path of the file that is being sent.\n- `stat` The stat object of the file that is being sent.\n\n#### `send` Options\n\nThe following options are also supported and will be passed directly to the\n[`send`](https://www.npmjs.com/package/send) module:\n\n- [`acceptRanges`](https://www.npmjs.com/package/send#acceptranges)\n- [`cacheControl`](https://www.npmjs.com/package/send#cachecontrol)\n- [`dotfiles`](https://www.npmjs.com/package/send#dotfiles)\n- [`etag`](https://www.npmjs.com/package/send#etag)\n- [`extensions`](https://www.npmjs.com/package/send#extensions)\n- [`immutable`](https://www.npmjs.com/package/send#immutable)\n- [`index`](https://www.npmjs.com/package/send#index)\n- [`lastModified`](https://www.npmjs.com/package/send#lastmodified)\n- [`maxAge`](https://www.npmjs.com/package/send#maxage)\n\n#### `wildcard`\n\nDefault: `true`\n\nIf set to `true`, `fastify-static` adds a wildcard route to serve files.\nIf set to `false`, `fastify-static` globs the filesystem for all defined\nfiles in the served folder, and just creates the routes needed for\nthose.\n\nThe default options of https://www.npmjs.com/package/glob are applied\nfor getting the file list.\n\n#### Disable serving\n\nIf you'd just like to use the reply decorator and not serve whole directories automatically, you can simply pass the option `{ serve: false }`. This will prevent the plugin from serving everything under `root`.\n\n#### Disabling reply decorator\n\nThe reply object is decorated with a `sendFile` function by default.  If you want to\ndisable this, pass the option `{ decorateReply: false }`.  If fastify-static is\nregisters to multiple prefixes in the same route only one can initialize reply\ndecorators.\n\n#### Handling 404s\n\nIf a request matches the URL `prefix` but a file cannot be found for the\nrequest, Fastify's 404 handler will be called. You can set a custom 404\nhandler with [`fastify.setNotFoundHandler()`](https://www.fastify.io/docs/latest/Server-Methods/#setnotfoundhandler).\n\n### Handling Errors\n\nIf an error occurs while trying to send a file, the error will be passed\nto Fastify's error handler. You can set a custom error handler with\n[`fastify.setErrorHandler()`](https://www.fastify.io/docs/latest/Server-Methods/#seterrorhandler).\n\n### Payload `stream.filename`\n\nIf you need to access the filename inside the `onSend` hook, you can use `payload.filename`.\n\n```js\nfastify.addHook('onSend', function (req, reply, payload, next) {\n  console.log(payload.filename)\n  next()\n})\n```\n\n## License\n\nLicensed under [MIT](./LICENSE)\n","gitHead":"3bf9b8811980fe66476ad60746133f24adabc249","license":"MIT","scripts":{"lint":"standard | snazzy","test":"npm run lint && npm run unit","unit":"tap test","example":"node example/server.js","coverage":"tap --cov --coverage-report=html test","coveralls":"tap test/*test.js  test/*/*.test.js --cov"},"_npmUser":{"name":"cemremengu","email":"cemremengu@gmail.com"},"homepage":"https://github.com/fastify/fastify-static","keywords":["fastify","static"],"repository":{"url":"git+https://github.com/fastify/fastify-static.git","type":"git"},"_npmVersion":"6.4.1","description":"Plugin for serving static files as fast as possible.","directories":{},"maintainers":[{"name":"allevo","email":"tomallevi@gmail.com"},{"name":"cemremengu","email":"cemremengu@gmail.com"},{"name":"delvedor","email":"tommydelved@gmail.com"},{"name":"jsumners","email":"james.sumners@gmail.com"},{"name":"matteo.collina","email":"hello@matteocollina.com"},{"name":"starptech","email":"deusdustin@gmail.com"},{"name":"trivikr","email":"trivikr.dev@gmail.com"}],"_nodeVersion":"10.13.0","dependencies":{"glob":"^7.1.3","send":"^0.16.0","fastify-plugin":"^1.2.0","readable-stream":"^3.0.2"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"tap":"^12.0.0","snazzy":"^8.0.0","fastify":"2.0.0-rc.3","standard":"^12.0.0","coveralls":"^3.0.2","pre-commit":"^1.2.2","proxyquire":"^2.1.0","simple-get":"^3.0.3","fastify-compress":"^0.7.0"},"_npmOperationalInternal":{"tmp":"tmp/fastify-static_2.1.0_1546706366756_0.9298575124927648","host":"s3://npm-registry-packages"},"_id":"fastify-static@2.1.0","version":"2.1.0"}