{"bugs":{"url":"https://github.com/fastify/fastify-static/issues"},"dist":{"shasum":"388a1ddf333b02288df1f21062701b1357ba75e4","tarball":"https://registry.npmjs.org/fastify-static/-/fastify-static-2.3.3.tgz","fileCount":21,"integrity":"sha512-TCpBX4O/nAW3EP9y6ocwYBHXvE/KuuDVG8aelY5cpeLnlc+DsTWEVZhtiJ2sG2u/qRRBdjk0S27VJR4Zo24Vsg==","signatures":[{"sig":"MEYCIQCpfFESmH1RWoUb8kJLhzbEzgCpV7V7f84yv8ADIYkgWwIhANz4ywECaW7YV6nQ7IrUKGCr3OIwIN0PDbZ8X4wqlZYp","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":62933,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcb6KPCRA9TVsSAnZWagAAPA0P/RktRmXOdRAmD1oMKApL\nZCny4EwGmi1lCWquT59LjnHg10d7WfGWQSwsQCSKBz/2ur8ljL9fYdDnwP8V\n+DGQaBROXmzw8SKOdfVffzaa+c/QGRDXvYu+SgLSZbojso1347qcnUYKxyZK\n347v93W65yLE56xSF2FMWDi7UR0qto7F4je+GozaKPB6ugxJOgWhGW/Ezxrg\nrp1NI4WNuf8Ax+3VzeEmqwRUT3THduVMzk1M3U1EJlsAHVvK2VUJr1o9Xzaa\nuSg5ndQNfMDMWufItIRjaRplo/tnrbBvFI9NIT15IsThvKOv9N/9wvZSGHKF\n4FqXawA8VqDPxZ70EzV/kFH8F/qeeLW5BjVES88iT+7eAfGwiGAhAv8vTSTB\n0+h+lwq0VcPTQNuo0XEKYRnbJOdpHpM8ugbGvd4xNNpMlKAh77kA0MpItEr+\ntsFx5PleCxaRIf8RZ8zhlR2CLjefUmTudDkSiyAOLV6LrXYwcCNnYJEh4giL\nXuAQds9yWjdTjK2UZmuiG0loT8obPwyQf/e/OacXDN+XlmwfYQmTHCYsTzO7\ncNJn9AG8nT7tYmwb8wOK+frdnfg6oQmWJHY6+t7Df5+PShaUva0Nu6BQQO62\nsz9wTCIpcn74EWykKnKHrJiNUEJeZ1H9QUzIA25vDes3Uv1U8PGWa37XtUyZ\nyX/x\r\n=leoB\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","name":"fastify-static","types":"index.d.ts","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#### `redirect`\n\nDefault: `false`\n\nIf set to `true`, `fastify-static` redirects to the directory with a trailing slash.\n\nThis option cannot be set to `true` with `wildcard` set to `false` on a server\nwith `ignoreTrailingSlash` set to `true`.\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\nThis option cannot be set to `false` with `redirect` set to `true` on a server\nwith `ignoreTrailingSlash` set to `true`.\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/#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":"e24f834ec9d89184d47f4bca38b37ecad902f3c3","license":"MIT","scripts":{"lint":"npm run lint:standard && npm run lint:typescript","test":"npm run lint && npm run unit && npm run typescript","unit":"tap test/*.test.js","example":"node example/server.js","coverage":"tap --cov --coverage-report=html test","coveralls":"tap test/*test.js  test/*/*.test.js --cov","typescript":"tsc --project ./test/types/tsconfig.json","lint:standard":"standard | snazzy","lint:typescript":"standard --parser typescript-eslint-parser --plugin typescript test/types/*.ts"},"_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":"ethan_arrowood","email":"ethan.arrowood@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.4.0","readable-stream":"^3.1.1"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"tap":"^12.5.1","snazzy":"^8.0.0","fastify":"^2.0.0-rc.6","standard":"^12.0.0","coveralls":"^3.0.2","pre-commit":"^1.2.2","proxyquire":"^2.1.0","simple-get":"^3.0.3","typescript":"^3.3.1","@types/node":"^10.12.21","fastify-compress":"^0.8.0","eslint-plugin-typescript":"^0.14.0","typescript-eslint-parser":"^22.0.0"},"_npmOperationalInternal":{"tmp":"tmp/fastify-static_2.3.3_1550819983297_0.28079680978162647","host":"s3://npm-registry-packages"},"_id":"fastify-static@2.3.3","version":"2.3.3"}