{"bin":{"ecstatic":"./lib/ecstatic.js"},"bugs":{"url":"https://github.com/jfhbrook/node-ecstatic/issues"},"dist":{"shasum":"1c7969b7a8893a04852e9373edeeb1d62809d393","tarball":"https://registry.npmjs.org/ecstatic/-/ecstatic-2.2.2.tgz","fileCount":69,"integrity":"sha512-F1g29y3I+abOS+M0AiK2O9R96AJ49Bc3kH696HtqnN+CL3YhpUnSzHNoUBQL03qDsN9Lr1XeKIxTqEH3BtiBgg==","signatures":[{"sig":"MEUCIHMCswVqyPSiYtPTPqDzY9tmgAJa/fLc3StAn0Rqy2YRAiEA8JrwVDVT6sVXJ7J76w9Kz7C6G8sa5O3wcHITCESTQJ8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":3604440,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJc20PMCRA9TVsSAnZWagAAtd4P/Rf3rMO0qDMnKAMzf43g\n1c72CVCc15tMLkPKS5JVHXm4iHArfPMKwkxbj7x9qPoSrwwEX4Dj5d6B1pCs\nL7A0hn8ZIbqspL7fB0n5FYe50X8GlKmuaPtw9hVZAz/q2T6sTcMI6HL16Owh\nz6SyS3SVn0EULlwsFOlyKY+Tu/GC89O3mwzlsRw1bQUSAl2nfkz8ll1Pz0Ha\nypIvVbiI4sJXpoQHA/S0xglkTndDQAvqef5b/OMaHWXYS+8ZR5QshDRrWL27\niuysXZnIzWYtrkyXsv7+iewaRzpb9wstRjlzuQ/Tn2oEma1DLd4UBRs5d908\nMydtmqwULHq0rnyV6hYrqx0akrF2PiyW1qff4W1T0wroSpTvMlJ33hbJKqjj\nXzTQ0ZYyVfs8kCaNXdRcims0pBmXHjugCyWlp29C0rz0g7QtwXO+6LoXPOvL\nRe248iH4mWWZZ+sPIYXBB3GPJj8dLribi5CUBWOBVcDhjXWfGZ56lBlv8c91\n6eleRmMk0HEDTRUWEKh/Nj7XeRNiMv2Cx8IxL2I4Z4KHeVZnlI/UsK6A0/k/\nZnarx2jaI8ZtzYmRMAhneTdO0ZbGigk5sbvh4LpJAZsLkWc7Oeq/KV+H5fIL\n/7YaLvGFuHdtZCkISjYjIQD43wwsfFW/o6D5lMUVISkf5QVGyrAIcRgdwfCS\nf3N6\r\n=VIP7\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./lib/ecstatic.js","name":"ecstatic","author":{"url":"http://jesusabdullah.net","name":"Joshua Holbrook","email":"josh@nodejitsu.com"},"readme":"# Ecstatic [![build status](https://secure.travis-ci.org/jfhbrook/node-ecstatic.png)](http://travis-ci.org/jfhbrook/node-ecstatic) [![codecov.io](https://codecov.io/github/jfhbrook/node-ecstatic/coverage.svg?branch=master)](https://codecov.io/github/jfhbrook/node-ecstatic?branch=master)\n\n![](http://imgur.com/vhub5.png)\n\nA simple static file server middleware. Use it with a raw http server,\nexpress/connect or on the CLI!\n\n# Examples:\n\n## express 4.x\n\n``` js\nvar http = require('http');\nvar express = require('express');\nvar ecstatic = require('ecstatic');\n\nvar app = express();\napp.use(ecstatic({ root: __dirname + '/public' }));\nhttp.createServer(app).listen(8080);\n\nconsole.log('Listening on :8080');\n```\n\n## stock http server\n\n``` js\nvar http = require('http');\nvar ecstatic = require('ecstatic');\n\nhttp.createServer(\n  ecstatic({ root: __dirname + '/public' })\n).listen(8080);\n\nconsole.log('Listening on :8080');\n```\n\n### fall through\nTo allow fall through to your custom routes:\n\n```js\necstatic({ root: __dirname + '/public', handleError: false })\n```\n\n## CLI\n\n```sh\necstatic ./public --port 8080\n```\n\n# Install:\n\nFor using ecstatic as a library, just npm install it into your project:\n\n```sh\nnpm install --save ecstatic\n```\n\nFor using ecstatic as a cli tool, either npm install it globally:\n\n```sh\nnpm install ecstatic -g\n```\n\nor install it locally and use npm runscripts to add it to your $PATH, or\nreference it directly with `./node_modules/.bin/ecstatic`.\n\n\n# API:\n\n## ecstatic(opts);\n## $ ecstatic [dir?] {options} --port PORT\n\nIn node, pass ecstatic an options hash, and it will return your middleware!\n\n```js\nvar opts = {\n             root               : __dirname + '/public',\n             port               : 8000,\n             baseDir            : '/',\n             cache              : 3600,\n             showDir            : true,\n             showDotfiles       : true,\n             autoIndex          : false,\n             humanReadable      : true,\n             headers            : {},\n             si                 : false,\n             defaultExt         : 'html',\n             gzip               : false,\n             serverHeader       : true,\n             contentType        : 'application/octet-stream',\n             mimeTypes          : undefined,\n             handleOptionsMethod: false\n           }\n```\n\nIf `opts` is a string, the string is assigned to the root folder and all other\noptions are set to their defaults.\n\nWhen running in CLI mode, all options work as above, passed in\n[optimist](https://github.com/substack/node-optimist) style. `port` defaults to\n`8000`. If a `dir` or `--root dir` argument is not passed, ecsatic will\nserve the current dir. Ecstatic also respects the PORT environment variable.\n\n### `opts.root`\n### `--root {root}`\n\n`opts.root` is the directory you want to serve up.\n\n### `opts.port`\n### `--port {port}`\n\nIn CLI mode, `opts.port` is the port you want ecstatic to listen to. Defaults\nto 8000. This can be overridden with the `--port` flag or with the PORT\nenvironment variable.\n\n### `opts.baseDir`\n### `--baseDir {dir}`\n\n`opts.baseDir` is `/` by default, but can be changed to allow your static files\nto be served off a specific route. For example, if `opts.baseDir === \"blog\"`\nand `opts.root = \"./public\"`, requests for `localhost:8080/blog/index.html` will\nresolve to `./public/index.html`.\n\n### `opts.cache`\n### `--cache {value}`\n\nCustomize cache control with `opts.cache` , if it is a number then it will set max-age in seconds.\nOther wise it will pass through directly to cache-control. Time defaults to 3600 s (ie, 1 hour).\n\nIf it is a function, it will be executed on every request, and passed the pathname.  Whatever it returns, string or number, will be used as the cache control header like above.\n\n### `opts.showDir`\n### `--no-showDir`\n\nTurn **off** directory listings with `opts.showDir === false`. Defaults to **true**.\n\n### `opts.showDotfiles`\n### `--no-showDotfiles`\n\nExclude dotfiles from directory listings with `opts.showDotfiles === false`. Defaults to **true**.\n\n### `opts.humanReadable`\n### `--no-human-readable`\n\nIf showDir is enabled, add human-readable file sizes. Defaults to **true**.\nAliases are `humanreadable` and `human-readable`.\n\n### `opts.headers`\n### `--H {HeaderA: valA} [--H {HeaderB: valB}]`\n\nSet headers on every response. `opts.headers` can be an object mapping string\nheader names to string header values, a colon (:) separated string, or an array\nof colon separated strings.\n\n`opts.H` and `opts.header` are aliased to `opts.headers` so that you can use\n`-H` and `--header` options to set headers on the command-line like curl:\n\n``` sh\n$ ecstatic ./public -p 5000 -H 'Access-Control-Allow-Origin: *'\n```\n\n### `opts.si`\n### `--si`\n\nIf showDir and humanReadable are enabled, print file sizes with base 1000 instead\nof base 1024. Name is inferred from cli options for `ls`. Aliased to `index`, the\nequivalent option in Apache.\n\n### `opts.autoIndex`\n### `--no-autoindex`\n\nServe `/path/index.html` when `/path/` is requested.\nTurn **off** autoIndexing with `opts.autoIndex === false`. Defaults to **true**.\n\n### `opts.defaultExt`\n### `--defaultExt {ext}`\n\nTurn on default file extensions with `opts.defaultExt`. If `opts.defaultExt` is\ntrue, it will default to `html`. For example if you want a request to `/a-file`\nto resolve to `./public/a-file.html`, set this to `true`. If you want\n`/a-file` to resolve to `./public/a-file.json` instead, set `opts.defaultExt` to\n`json`.\n\n### `opts.gzip`\n### `--gzip`\n\nSet `opts.gzip === true` in order to turn on \"gzip mode,\" wherein ecstatic will\nserve `./public/some-file.js.gz` in place of `./public/some-file.js` when the\ngzipped version exists and ecstatic determines that the behavior is appropriate.\n\n### `opts.serverHeader`\n### `--no-server-header`\n\nSet `opts.serverHeader` to false in order to turn off setting the `Server` header\non all responses served by ecstatic.\n\n### `opts.contentType`\n### `--content-type {type}`\n\nSet `opts.contentType` in order to change default Content-Type header value.\nDefaults to **application/octet-stream**.\n\n### `opts.mimeTypes`\n### `--mime-types {filename}`\n\nAdd new or override one or more mime-types. This affects the HTTP Content-Type header.\nCan either be a path to a [`.types`](http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types) file or an object hash of type(s).\n\n    ecstatic({ mimeType: { 'mime-type': ['file_extension', 'file_extension'] } })\n\n### `opts.handleError`\n\nTurn **off** handleErrors to allow fall-through with `opts.handleError === false`, Defaults to **true**.\n\n### `opts.weakEtags`\n### `--weak-etags`\n\nSet `opts.weakEtags` to true in order to generate weak etags instead of strong etags. Defaults to **false**. See `opts.weakCompare` as well.\n\n### `opts.weakCompare`\n### `--weak-compare`\n\nTurn **on** weakCompare to allow the weak comparison function for etag validation. Defaults to **false**.\nSee https://www.ietf.org/rfc/rfc2616.txt Section 13.3.3 for more details.\n\n### `opts.handleOptionsMethod`\n### `--handle-options-method`\n\nSet handleOptionsMethod to true in order to respond to 'OPTIONS' calls with any standard/set headers. Defaults to **false**. Useful for hacking up CORS support.\n\n### `opts.cors`\n### `--cors`\n\nThis is a **convenience** setting which turns on `handleOptionsMethod` and sets the headers **Access-Control-Allow-Origin: \\*** and **Access-Control-Allow-Headers: Authorization, Content-Type, If-Match, If-Modified-Since, If-None-Match, If-Unmodified-Since**. This *should* be enough to quickly make cross-origin resource sharing work between development APIs. More advanced usage can come either from overriding these headers with the headers argument, or by using the `handleOptionsMethod` flag and then setting headers \"manually.\" Alternately, just do it in your app using separate middlewares/abstractions.\n\nDefaults to **false**.\n\n## middleware(req, res, next);\n\nThis works more or less as you'd expect.\n\n### ecstatic.showDir(folder);\n\nThis returns another middleware which will attempt to show a directory view. Turning on auto-indexing is roughly equivalent to adding this middleware after an ecstatic middleware with autoindexing disabled.\n\n# Tests:\n\nEcstatic has a fairly extensive test suite. You can run it with:\n\n```sh\n$ npm test\n```\n\n# Contribute:\n\nWithout outside contributions, ecstatic would wither and die! Before\ncontributing, take a quick look at the contributing guidelines in\n[./CONTRIBUTING.md](./CONTRIBUTING.md) . They're relatively painless, I promise.\n\n# License:\n\nMIT. See LICENSE.txt. For contributors, see CONTRIBUTORS.md\n","gitHead":"709c0f09a419ebb3419eeb969b4ba987dc3b547a","license":"MIT","scripts":{"test":"tap --coverage test/*.js","posttest":"tap --coverage-report=text-lcov | codecov"},"_npmUser":{"name":"jfhbrook","email":"josh.holbrook@gmail.com"},"homepage":"https://github.com/jfhbrook/node-ecstatic","keywords":["static","web","server","files","mime","middleware"],"deprecated":"This package is unmaintained and deprecated. See the GH Issue 259.","repository":{"url":"git+ssh://git@github.com/jfhbrook/node-ecstatic.git","type":"git"},"_npmVersion":"6.9.0","description":"A simple static file server middleware that works with both Express and Flatiron","directories":{},"maintainers":[{"name":"jesusabdullah","email":"josh.holbrook@gmail.com"},{"name":"jfhbrook","email":"josh.holbrook@gmail.com"}],"_nodeVersion":"10.15.1","dependencies":{"he":"^1.1.1","mime":"^1.2.11","minimist":"^1.1.0","url-join":"^2.0.2"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"eol":"^0.9.0","tap":"^10.3.3","mkdirp":"^0.5.0","codecov":"^2.2.0","express":"^4.12.3","request":"^2.49.0"},"_npmOperationalInternal":{"tmp":"tmp/ecstatic_2.2.2_1557873611663_0.2682096795506532","host":"s3://npm-registry-packages"},"_id":"ecstatic@2.2.2","version":"2.2.2"}