129 lines
8.2 KiB
JSON
129 lines
8.2 KiB
JSON
{
|
|
"_args": [
|
|
[
|
|
{
|
|
"raw": "serve-index@~1.7.2",
|
|
"scope": null,
|
|
"escapedName": "serve-index",
|
|
"name": "serve-index",
|
|
"rawSpec": "~1.7.2",
|
|
"spec": ">=1.7.2 <1.8.0",
|
|
"type": "range"
|
|
},
|
|
"/home/jdaugherty/work/GT2/GT2-Android/node_modules/connect"
|
|
]
|
|
],
|
|
"_from": "serve-index@>=1.7.2 <1.8.0",
|
|
"_id": "serve-index@1.7.3",
|
|
"_inCache": true,
|
|
"_location": "/serve-index",
|
|
"_nodeVersion": "4.2.3",
|
|
"_npmUser": {
|
|
"name": "dougwilson",
|
|
"email": "doug@somethingdoug.com"
|
|
},
|
|
"_npmVersion": "2.14.7",
|
|
"_phantomChildren": {
|
|
"inherits": "2.0.3",
|
|
"mime-types": "2.1.17",
|
|
"statuses": "1.4.0"
|
|
},
|
|
"_requested": {
|
|
"raw": "serve-index@~1.7.2",
|
|
"scope": null,
|
|
"escapedName": "serve-index",
|
|
"name": "serve-index",
|
|
"rawSpec": "~1.7.2",
|
|
"spec": ">=1.7.2 <1.8.0",
|
|
"type": "range"
|
|
},
|
|
"_requiredBy": [
|
|
"/connect"
|
|
],
|
|
"_resolved": "https://registry.npmjs.org/serve-index/-/serve-index-1.7.3.tgz",
|
|
"_shasum": "7a057fc6ee28dc63f64566e5fa57b111a86aecd2",
|
|
"_shrinkwrap": null,
|
|
"_spec": "serve-index@~1.7.2",
|
|
"_where": "/home/jdaugherty/work/GT2/GT2-Android/node_modules/connect",
|
|
"author": {
|
|
"name": "Douglas Christopher Wilson",
|
|
"email": "doug@somethingdoug.com"
|
|
},
|
|
"bugs": {
|
|
"url": "https://github.com/expressjs/serve-index/issues"
|
|
},
|
|
"dependencies": {
|
|
"accepts": "~1.2.13",
|
|
"batch": "0.5.3",
|
|
"debug": "~2.2.0",
|
|
"escape-html": "~1.0.3",
|
|
"http-errors": "~1.3.1",
|
|
"mime-types": "~2.1.9",
|
|
"parseurl": "~1.3.1"
|
|
},
|
|
"description": "Serve directory listings",
|
|
"devDependencies": {
|
|
"after": "0.8.1",
|
|
"istanbul": "0.4.2",
|
|
"mocha": "2.3.4",
|
|
"supertest": "1.1.0"
|
|
},
|
|
"directories": {},
|
|
"dist": {
|
|
"shasum": "7a057fc6ee28dc63f64566e5fa57b111a86aecd2",
|
|
"tarball": "https://registry.npmjs.org/serve-index/-/serve-index-1.7.3.tgz"
|
|
},
|
|
"engines": {
|
|
"node": ">= 0.8.0"
|
|
},
|
|
"files": [
|
|
"public/",
|
|
"LICENSE",
|
|
"HISTORY.md",
|
|
"index.js"
|
|
],
|
|
"gitHead": "fc9db6b56a5bd6ae37f635a7cc7230ab83343fc1",
|
|
"homepage": "https://github.com/expressjs/serve-index#readme",
|
|
"license": "MIT",
|
|
"maintainers": [
|
|
{
|
|
"name": "dougwilson",
|
|
"email": "doug@somethingdoug.com"
|
|
},
|
|
{
|
|
"name": "jongleberry",
|
|
"email": "jonathanrichardong@gmail.com"
|
|
},
|
|
{
|
|
"name": "tjholowaychuk",
|
|
"email": "tj@vision-media.ca"
|
|
},
|
|
{
|
|
"name": "mscdex",
|
|
"email": "mscdex@mscdex.net"
|
|
},
|
|
{
|
|
"name": "fishrock123",
|
|
"email": "fishrock123@rocketmail.com"
|
|
},
|
|
{
|
|
"name": "defunctzombie",
|
|
"email": "shtylman@gmail.com"
|
|
}
|
|
],
|
|
"name": "serve-index",
|
|
"optionalDependencies": {},
|
|
"readme": "# serve-index\r\n\r\n[![NPM Version][npm-image]][npm-url]\r\n[![NPM Downloads][downloads-image]][downloads-url]\r\n[![Linux Build][travis-image]][travis-url]\r\n[![Windows Build][appveyor-image]][appveyor-url]\r\n[![Test Coverage][coveralls-image]][coveralls-url]\r\n[![Gratipay][gratipay-image]][gratipay-url]\r\n\r\n Serves pages that contain directory listings for a given path.\r\n\r\n## Install\r\n\r\n```sh\r\n$ npm install serve-index\r\n```\r\n\r\n## API\r\n\r\n```js\r\nvar serveIndex = require('serve-index')\r\n```\r\n\r\n### serveIndex(path, options)\r\n\r\nReturns middlware that serves an index of the directory in the given `path`.\r\n\r\nThe `path` is based off the `req.url` value, so a `req.url` of `'/some/dir`\r\nwith a `path` of `'public'` will look at `'public/some/dir'`. If you are using\r\nsomething like `express`, you can change the URL \"base\" with `app.use` (see\r\nthe express example).\r\n\r\n#### Options\r\n\r\nServe index accepts these properties in the options object.\r\n\r\n##### filter\r\n\r\nApply this filter function to files. Defaults to `false`. The `filter` function\r\nis called for each file, with the signature `filter(filename, index, files, dir)`\r\nwhere `filename` is the name of the file, `index` is the array index, `files` is\r\nthe array of files and `dir` is the absolute path the file is located (and thus,\r\nthe directory the listing is for).\r\n\r\n##### hidden\r\n\r\nDisplay hidden (dot) files. Defaults to `false`.\r\n\r\n##### icons\r\n\r\nDisplay icons. Defaults to `false`.\r\n\r\n##### stylesheet\r\n\r\nOptional path to a CSS stylesheet. Defaults to a built-in stylesheet.\r\n\r\n##### template\r\n\r\nOptional path to an HTML template or a function that will render a HTML\r\nstring. Defaults to a built-in template.\r\n\r\nWhen given a string, the string is used as a file path to load and then the\r\nfollowing tokens are replaced in templates:\r\n\r\n * `{directory}` with the name of the directory.\r\n * `{files}` with the HTML of an unordered list of file links.\r\n * `{linked-path}` with the HTML of a link to the directory.\r\n * `{style}` with the specified stylesheet and embedded images.\r\n\r\nWhen given as a function, the function is called as `template(locals, callback)`\r\nand it needs to invoke `callback(error, htmlString)`. The following are the\r\nprovided locals:\r\n\r\n * `directory` is the directory being displayed (where `/` is the root).\r\n * `displayIcons` is a Boolean for if icons should be rendered or not.\r\n * `fileList` is a sorted array of files in the directory. The array contains\r\n objects with the following properties:\r\n - `name` is the relative name for the file.\r\n - `stat` is a `fs.Stats` object for the file.\r\n * `path` is the full filesystem path to `directory`.\r\n * `style` is the default stylesheet or the contents of the `stylesheet` option.\r\n * `viewName` is the view name provided by the `view` option.\r\n\r\n##### view\r\n\r\nDisplay mode. `tiles` and `details` are available. Defaults to `tiles`.\r\n\r\n## Examples\r\n\r\n### Serve directory indexes with vanilla node.js http server\r\n\r\n```js\r\nvar finalhandler = require('finalhandler')\r\nvar http = require('http')\r\nvar serveIndex = require('serve-index')\r\nvar serveStatic = require('serve-static')\r\n\r\n// Serve directory indexes for public/ftp folder (with icons)\r\nvar index = serveIndex('public/ftp', {'icons': true})\r\n\r\n// Serve up public/ftp folder files\r\nvar serve = serveStatic('public/ftp')\r\n\r\n// Create server\r\nvar server = http.createServer(function onRequest(req, res){\r\n var done = finalhandler(req, res)\r\n serve(req, res, function onNext(err) {\r\n if (err) return done(err)\r\n index(req, res, done)\r\n })\r\n})\r\n\r\n// Listen\r\nserver.listen(3000)\r\n```\r\n\r\n### Serve directory indexes with express\r\n\r\n```js\r\nvar express = require('express')\r\nvar serveIndex = require('serve-index')\r\n\r\nvar app = express()\r\n\r\n// Serve URLs like /ftp/thing as public/ftp/thing\r\napp.use('/ftp', serveIndex('public/ftp', {'icons': true}))\r\napp.listen()\r\n```\r\n\r\n## License\r\n\r\n[MIT](LICENSE). The [Silk](http://www.famfamfam.com/lab/icons/silk/) icons\r\nare created by/copyright of [FAMFAMFAM](http://www.famfamfam.com/).\r\n\r\n[npm-image]: https://img.shields.io/npm/v/serve-index.svg\r\n[npm-url]: https://npmjs.org/package/serve-index\r\n[travis-image]: https://img.shields.io/travis/expressjs/serve-index/master.svg?label=linux\r\n[travis-url]: https://travis-ci.org/expressjs/serve-index\r\n[appveyor-image]: https://img.shields.io/appveyor/ci/dougwilson/serve-index/master.svg?label=windows\r\n[appveyor-url]: https://ci.appveyor.com/project/dougwilson/serve-index\r\n[coveralls-image]: https://img.shields.io/coveralls/expressjs/serve-index/master.svg\r\n[coveralls-url]: https://coveralls.io/r/expressjs/serve-index?branch=master\r\n[downloads-image]: https://img.shields.io/npm/dm/serve-index.svg\r\n[downloads-url]: https://npmjs.org/package/serve-index\r\n[gratipay-image]: https://img.shields.io/gratipay/dougwilson.svg\r\n[gratipay-url]: https://www.gratipay.com/dougwilson/\r\n",
|
|
"readmeFilename": "README.md",
|
|
"repository": {
|
|
"type": "git",
|
|
"url": "git+https://github.com/expressjs/serve-index.git"
|
|
},
|
|
"scripts": {
|
|
"test": "mocha --reporter spec --bail --check-leaks test/",
|
|
"test-ci": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/",
|
|
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/"
|
|
},
|
|
"version": "1.7.3"
|
|
}
|