{"_id":"think-resource","_rev":"6-a0663c5c49af5349d52c1242ba74ca79","name":"think-resource","description":"Resource for ThinkJS 3.x ","dist-tags":{"latest":"1.0.3"},"versions":{"1.0.0":{"name":"think-resource","version":"1.0.0","description":"Resource for ThinkJS 3.x ","main":"index.js","scripts":{"test":"eslint index.js && nyc ava test/index.js && nyc report --reporter=html"},"repository":{"type":"git","url":"git+https://github.com/thinkjs/think-resource.git"},"keywords":["resource","thinkjs","node","static"],"author":{"name":"xiamingxing"},"engines":{"node":">=6.0.0"},"license":"MIT","bugs":{"url":"https://github.com/thinkjs/think-resource/issues"},"homepage":"https://github.com/thinkjs/think-resource#readme","dependencies":{"debug":"^2.6.3","koa-send":"3.3.0","think-helper":"latest"},"devDependencies":{"ava":"^0.19.1","babel-eslint":"^7.2.1","babel-preset-think-node":"^1.0.1","coveralls":"^2.13.0","eslint":"^3.19.0","koa":"^2.2.0","nyc":"^10.2.0","supertest":"^3.0.0","think-helper":"latest"},"ava":{"require":["babel-core/register"],"babel":"inherit"},"babel":{"presets":["think-node"]},"gitHead":"3cb9214a29fda709660f8e16209a30779d1ae803","_id":"think-resource@1.0.0","_shasum":"1651ca3f362c7d2670ade6e8ce18a27854d37cf4","_from":".","_npmVersion":"4.5.0","_nodeVersion":"6.10.2","_npmUser":{"name":"xiamingxing","email":"xiamingxing725@gmail.com"},"dist":{"shasum":"1651ca3f362c7d2670ade6e8ce18a27854d37cf4","tarball":"https://registry.npmjs.org/think-resource/-/think-resource-1.0.0.tgz","integrity":"sha512-UkO+8ijo0Aad2pno0ahv2ZQiTH1PpsVvAnYwWs4Fr8X0qfk8Hx+s2vyvMQGwpw8J6kiP0uPT4rdq0WoLvSWqig==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBGQI787q8IKDEmUHZlPhmSlZSPqBPBIj2kDMRIN8sExAiAsbyGqX63xQ3QQWR09qt/F+laKcamwEjOPQS8qJINSXQ=="}]},"maintainers":[{"name":"xiamingxing","email":"xiamingxing725@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/think-resource-1.0.0.tgz_1492485436542_0.5136669247876853"}},"1.0.1":{"name":"think-resource","version":"1.0.1","description":"Resource for ThinkJS 3.x ","main":"index.js","scripts":{"test":"eslint index.js && nyc ava test/index.js && nyc report --reporter=html"},"repository":{"type":"git","url":"git+https://github.com/thinkjs/think-resource.git"},"keywords":["resource","thinkjs","node","static"],"author":{"name":"xiamingxing"},"engines":{"node":">=6.0.0"},"license":"MIT","bugs":{"url":"https://github.com/thinkjs/think-resource/issues"},"homepage":"https://github.com/thinkjs/think-resource#readme","dependencies":{"debug":"^2.6.3","koa-send":"3.3.0","think-helper":"latest"},"devDependencies":{"ava":"^0.19.1","babel-eslint":"^7.2.1","babel-preset-think-node":"^1.0.1","coveralls":"^2.13.0","eslint":"^3.19.0","koa":"^2.2.0","nyc":"^10.2.0","supertest":"^3.0.0","think-helper":"latest"},"ava":{"require":["babel-core/register"],"babel":"inherit"},"babel":{"presets":["think-node"]},"gitHead":"ea389d0d93cfb7468b70644df6ed88f8da11971b","_id":"think-resource@1.0.1","_shasum":"33f7e7ea748b25769bd8b1cc3a24f041342fc3c8","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.10.2","_npmUser":{"name":"xiamingxing","email":"xiamingxing725@gmail.com"},"dist":{"shasum":"33f7e7ea748b25769bd8b1cc3a24f041342fc3c8","tarball":"https://registry.npmjs.org/think-resource/-/think-resource-1.0.1.tgz","integrity":"sha512-nDx3mHbuSAxY+Xnlb5wdcweyVe/9QuwwAzD7njNCvI2jXGPWMiS1OVICePNyYpdS53Zsnp48icrZE9jjPQXvPQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDM7TOwrSnNe7zlD44g8rvs1XkldSj6cTzoLzq85y0/WAiEAshAo7uLJv3xLxhjjFCd01k7o7g7cBaZrxwuV9o3UaEs="}]},"maintainers":[{"name":"xiamingxing","email":"xiamingxing725@gmail.com"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/think-resource-1.0.1.tgz_1494314046524_0.8773323323111981"}},"1.0.2":{"name":"think-resource","version":"1.0.2","description":"Resource for ThinkJS 3.x ","main":"index.js","scripts":{"test":"eslint index.js && nyc ava test/index.js && nyc report --reporter=html"},"repository":{"type":"git","url":"git+https://github.com/thinkjs/think-resource.git"},"keywords":["resource","thinkjs","node","static"],"author":{"name":"xiamingxing"},"engines":{"node":">=6.0.0"},"license":"MIT","bugs":{"url":"https://github.com/thinkjs/think-resource/issues"},"homepage":"https://github.com/thinkjs/think-resource#readme","dependencies":{"debug":"^2.6.3","koa-send":"3.3.0","think-helper":"latest"},"devDependencies":{"ava":"^0.19.1","babel-eslint":"^7.2.1","babel-preset-think-node":"^1.0.1","coveralls":"^2.13.0","eslint":"^3.19.0","koa":"^2.2.0","nyc":"^10.2.0","supertest":"^3.0.0","think-helper":"latest"},"ava":{"require":["babel-core/register"],"babel":"inherit"},"babel":{"presets":["think-node"]},"gitHead":"bed5d857c95eb067dd287e73f7a23d521fb74a4a","_id":"think-resource@1.0.2","_npmVersion":"5.0.3","_nodeVersion":"6.10.2","_npmUser":{"name":"xiamingxing","email":"xiamingxing725@gmail.com"},"dist":{"integrity":"sha512-Niyk2Sk1PtZFVuUYPD+2Udy7BXQfmd2VNC0gM6h1w6SNMPTQQ+vcD32V/mPHmxSEInKDhDrUjeyQ22i8Q5KLgQ==","shasum":"b0749b8ecbeda11a0960d06b6804ddd170fe91ff","tarball":"https://registry.npmjs.org/think-resource/-/think-resource-1.0.2.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICzOGW714tVBzs31NCyYtQ7N0371NyCv2RiPk7SMAkDiAiA0W4oy0l+UyLVGaEWfrt5VZdDFxFKpg3Ug7EC8IKomnQ=="}]},"maintainers":[{"name":"xiamingxing","email":"xiamingxing725@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/think-resource-1.0.2.tgz_1497406659508_0.9720347044058144"}},"1.0.3":{"name":"think-resource","version":"1.0.3","description":"Resource for ThinkJS 3.x ","main":"index.js","scripts":{"test":"eslint index.js && nyc ava test/index.js && nyc report --reporter=html"},"repository":{"type":"git","url":"git+https://github.com/thinkjs/think-resource.git"},"keywords":["resource","thinkjs","node","static"],"author":{"name":"xiamingxing"},"engines":{"node":">=6.0.0"},"license":"MIT","bugs":{"url":"https://github.com/thinkjs/think-resource/issues"},"homepage":"https://github.com/thinkjs/think-resource#readme","dependencies":{"debug":"^2.6.3","koa-send":"3.3.0","think-helper":"latest"},"devDependencies":{"ava":"^0.19.1","babel-eslint":"^7.2.1","babel-preset-think-node":"^1.0.1","coveralls":"^2.13.0","eslint":"^3.19.0","koa":"^2.2.0","nyc":"^10.2.0","supertest":"^3.0.0","think-helper":"latest"},"ava":{"require":["babel-core/register"],"babel":"inherit"},"babel":{"presets":["think-node"]},"gitHead":"b73d525355dbc96c50b02fcd95c108f8d782fd50","_id":"think-resource@1.0.3","_npmVersion":"5.0.3","_nodeVersion":"6.10.2","_npmUser":{"name":"xiamingxing","email":"xiamingxing725@gmail.com"},"dist":{"integrity":"sha512-NEaSBinj95yr5z2rM1Sx89P90iKZMhkIFzW/EgstnYEFQJRQO43mFByqZBhR01pOU3YL34Y+jL8Zjxd0szRrMg==","shasum":"abb8854dec01033ad0603d4424bc3d02ceb8f852","tarball":"https://registry.npmjs.org/think-resource/-/think-resource-1.0.3.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDoeAins0I3ccz4cdN0By6UZiymJzDilgvJkDroGx5/FgIgDizFuws1SK3RcrmOYC9GWpR7jPc2GCgP/RycK+Mbssk="}]},"maintainers":[{"name":"xiamingxing","email":"xiamingxing725@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/think-resource-1.0.3.tgz_1497406827669_0.8333958107978106"}}},"readme":"# think-resource\nResource for ThinkJS 3.x\n\n[![npm](https://img.shields.io/npm/v/think-resource.svg)](https://www.npmjs.com/package/think-resource)\n[![Build Status](https://travis-ci.org/thinkjs/think-resource.svg?branch=master)](https://travis-ci.org/thinkjs/think-resource)\n[![Coverage Status](https://coveralls.io/repos/github/thinkjs/think-resource/badge.svg?branch=master)](https://coveralls.io/github/thinkjs/think-resource?branch=master)\n\nthink-resource is an static-file handler for ThinkJS 3.x. \n\n## Installation\n\n```\n$  npm install think-resource\n```\n\n## \n\n## API\n\nModify `src/config/middleware.js`\n\n```js\nconst resource = require('think-resource')\n\nmodule.exports = [\n  { \n      handle: resource,\n      options: {\n           root: '.',\n           publicPath: '/static',\n           index: 'index.html',\n           hidden: false,\n           format: true,\n           gzip: false,\n           extensions: ['.txt'],\n           maxage: 0,\n           setHeaders: function(res, path, stats) {\n              ...\n           },\n           notFoundNext: false\n      }\n  }\n]\n```\n\n### Options\n\n- `root`:  Root directory to restrict file access， `require`.\n- `index`: Default file name, default is `index.html`.\n- `hidden`: Allow transfer of hidden files. default is `false`.\n- `format`:  If not false (defaults to true), format the path to serve static file servers and not require a trailing slash for directories, so that you can do both /directory and /directory/, default is `false`.\n- `gzip`: Try to serve the gzipped version of a file automatically when gzip is supported by a client and if the requested file with .gz extension exists. default is `false`.\n- `extensions`: Try to match extensions from passed array to search for file when no extension is sufficed in URL. First found is served. default is `false`.\n- `maxage`: Function to set custom headers on response. Browser cache max-age in milliseconds, default is `0`.\n- `publicPath`: Public path for route-match. default is `/`.\n- `setHeaders`: Function to set custom headers on response. default is `false`. usage: `setHeaders: function(res, path, stats){}`\n- `notFoundNext`: If it can't find target file, will continue excuting `next` function.  default is `false`.\n\n## Contributing\n\nContributions welcome!\n\n## License\n\n[Mit](https://github.com/thinkjs/think-resource/blob/master/LICENSE)\n","maintainers":[{"name":"xiamingxing","email":"xiamingxing725@gmail.com"}],"time":{"modified":"2022-06-27T06:10:27.051Z","created":"2017-04-18T03:17:16.767Z","1.0.0":"2017-04-18T03:17:16.767Z","1.0.1":"2017-05-09T07:14:09.422Z","1.0.2":"2017-06-14T02:17:39.687Z","1.0.3":"2017-06-14T02:20:27.769Z"},"homepage":"https://github.com/thinkjs/think-resource#readme","keywords":["resource","thinkjs","node","static"],"repository":{"type":"git","url":"git+https://github.com/thinkjs/think-resource.git"},"author":{"name":"xiamingxing"},"bugs":{"url":"https://github.com/thinkjs/think-resource/issues"},"license":"MIT","readmeFilename":"README.md"}