{ "_args": [ [ "ecstatic@^3.0.0", "/home/solomon/ownCloud/Personal/workspace/inkletblot.com/node_modules/http-server" ] ], "_from": "ecstatic@>=3.0.0 <4.0.0", "_hasShrinkwrap": false, "_id": "ecstatic@3.3.2", "_inCache": true, "_installable": true, "_location": "/ecstatic", "_nodeVersion": "10.15.1", "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/ecstatic_3.3.2_1557873636362_0.1205833878391045" }, "_npmUser": { "email": "josh.holbrook@gmail.com", "name": "jfhbrook" }, "_npmVersion": "6.9.0", "_phantomChildren": {}, "_requested": { "name": "ecstatic", "raw": "ecstatic@^3.0.0", "rawSpec": "^3.0.0", "scope": null, "spec": ">=3.0.0 <4.0.0", "type": "range" }, "_requiredBy": [ "/http-server" ], "_resolved": "https://registry.npmjs.org/ecstatic/-/ecstatic-3.3.2.tgz", "_shasum": "6d1dd49814d00594682c652adb66076a69d46c48", "_shrinkwrap": null, "_spec": "ecstatic@^3.0.0", "_where": "/home/solomon/ownCloud/Personal/workspace/inkletblot.com/node_modules/http-server", "author": { "email": "josh@nodejitsu.com", "name": "Joshua Holbrook", "url": "http://jesusabdullah.net" }, "bin": { "ecstatic": "./lib/ecstatic.js" }, "bugs": { "url": "https://github.com/jfhbrook/node-ecstatic/issues" }, "dependencies": { "he": "^1.1.1", "mime": "^1.6.0", "minimist": "^1.1.0", "url-join": "^2.0.5" }, "description": "A simple static file server middleware", "devDependencies": { "eol": "^0.9.1", "eslint": "^3.19.0", "eslint-config-airbnb-base": "^11.3.2", "eslint-plugin-import": "^2.14.0", "express": "^4.16.3", "mkdirp": "^0.5.0", "request": "^2.88.0", "tap": "^12.0.1" }, "directories": {}, "dist": { "fileCount": 27, "integrity": "sha512-fLf9l1hnwrHI2xn9mEDT7KIi22UDqA2jaCwyCbSUJh9a1V+LEUSL/JO/6TIz/QyuBURWUHrFL5Kg2TtO1bkkog==", "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJc20PkCRA9TVsSAnZWagAAVN0P/js6sA8WqJF/aQ5o0hkF\nGJAuqXC/Xvfg5MBd4kDTJlPDPAekgi3E1YeiCgMw/dvuAf5wGjkv4smVXyoY\n6VsiTNzI7y3E2Yzq68Dj6ki/CpYoIm2FZuNoJSH3dM6X2u9R0sQbZwrWgaOo\nfNPFwDKN0Wz5ep6351qUlVHK2poYnSBUSfKI2wKkuUTGTtxGq2C6xJ0sPlqm\nC5erCowrUa6X+5XP6eyO7Vf5jNjm594jDovSaZ25Z+D52jeYdnmcy/5XmSLH\nDI2yyfN/fZUd9pPveBUCz8K6uykTfNf1Zl4d7PJMFZZHxzJPEIBypAFJTIFt\nBMaw4/OrJFMPa0FlbgBbThgzzgmYyd5Bm0g1xoU6nIool5hega70toE/1Ke2\na9u4UXwiIUiDP4OtXcYn0PeYyQodu0JBAgeo8JsFTEPQFG4qNYofjS1JSICZ\nuI1n6niVSxIRoKTyXLWKq/dwAJQcQRVIbBmKBoeoURXCDdyED7ixlig2Zhh1\nJMCUyYPwSmIg1imq3yylU6IkumbWCplQam3caQkJUr7C7YFyv2eCfz0IzCQ6\nv6+ZZU+87d0eT2BLREr95rfiyRPeTF71MEsIfB6MfLvO+GU+5vhl66MsVLFc\nckIkKOvUFkS6YzFnnc/ibzto23M3SC68VhwmQAQipgDpOn4wWHJaIdJex3vn\nNW73\r\n=GejV\r\n-----END PGP SIGNATURE-----\r\n", "shasum": "6d1dd49814d00594682c652adb66076a69d46c48", "tarball": "https://registry.npmjs.org/ecstatic/-/ecstatic-3.3.2.tgz", "unpackedSize": 313313 }, "gitHead": "07131c2c8e9f2d839e0a2102292010facad565a0", "homepage": "https://github.com/jfhbrook/node-ecstatic", "keywords": [ "files", "middleware", "mime", "server", "static", "web" ], "license": "MIT", "main": "./lib/ecstatic.js", "maintainers": [ { "name": "jesusabdullah", "email": "josh.holbrook@gmail.com" }, { "name": "jfhbrook", "email": "josh.holbrook@gmail.com" } ], "name": "ecstatic", "optionalDependencies": {}, "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\n'use strict';\n\nconst express = require('express');\nconst ecstatic = require('../lib/ecstatic');\nconst http = require('http');\n\nconst app = express();\n\napp.use(ecstatic({\n root: `${__dirname}/public`,\n showdir: true,\n}));\n\nhttp.createServer(app).listen(8080);\n\nconsole.log('Listening on :8080');\n```\n\n## stock http server\n\n``` js\n'use strict';\n\nconst http = require('http');\n\nconst ecstatic = require('../lib/ecstatic')({\n root: `${__dirname}/public`,\n showDir: true,\n autoIndex: true,\n});\n\nhttp.createServer(ecstatic).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\nconst opts = {\n root: path.join(__dirname, 'public'),\n baseDir: '/',\n autoIndex: true,\n showDir: true,\n showDotfiles: true,\n humanReadable: true,\n hidePermissions: false,\n si: false,\n cache: 'max-age=3600',\n cors: false,\n gzip: true,\n brotli: false,\n defaultExt: 'html',\n handleError: true,\n serverHeader: true,\n contentType: 'application/octet-stream',\n weakEtags: true,\n weakCompare: true,\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.hidePermissions`\n### `--hide-permissions`\nIf hidePermissions is enabled, file permissions will not be displayed. Defaults to **false**.\nAliases are `hidepermissions` and `hide-permissions`.\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### `--no-gzip`\n\nBy default, ecstatic will serve `./public/some-file.js.gz` in place of\n`./public/some-file.js` when the gzipped version exists and ecstatic determines\nthat the behavior is appropriate. If `./public/some-file.js.gz` is not valid\ngzip, this will fall back to `./public/some-file.js`. You can turn this off\nwith `opts.gzip === false`.\n\n### `opts.brotli`\n### `--brotli`\n\nServe `./public/some-file.js.br` in place of `./public/some-file.js` when the \n[brotli encoded](https://github.com/google/brotli) version exists and ecstatic \ndetermines that the behavior is appropriate. If the request does not contain \n`br` in the HTTP `accept-encoding` header, ecstatic will instead attempt to \nserve a gzipped version (if `opts.gzip` is `true`), or fall back to \n`./public.some-file.js`. Defaults to **false**.\n\n### `opts.serverHeader`\n### `--no-server-header`\n\nSet `opts.serverHeader` to false in order to turn off setting the `Server`\nheader on 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\nheader. Can either be a path to a\n[`.types`](http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types)\nfile or an object hash of type(s).\n\n ecstatic({ mimeTypes: { 'mime-type': ['file_extension', 'file_extension'] } })\n\n### `opts.handleError`\n\nTurn **off** handleErrors to allow fall-through with\n`opts.handleError === false`, Defaults to **true**.\n\n### `opts.weakEtags`\n### `--no-weak-etags`\n\nSet `opts.weakEtags` to false in order to generate strong etags instead of\nweak etags. Defaults to **true**. See `opts.weakCompare` as well.\n\n### `opts.weakCompare`\n### `--no-weak-compare`\n\nTurn off weakCompare to disable the weak comparison function for etag\nvalidation. Defaults to **true**. See\nhttps://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", "readmeFilename": "README.md", "repository": { "type": "git", "url": "git+ssh://git@github.com/jfhbrook/node-ecstatic.git" }, "scripts": { "fix": "eslint --fix ./lib/ ./example/ ./test", "posttest": "tap --coverage-report=clover", "pretest": "eslint ./lib/ ./example/ ./test", "test": "tap --jobs-auto --coverage test/*.js" }, "version": "3.3.2" }