Comparing version 1.2.0 to 1.3.0
@@ -0,1 +1,4 @@ | ||
2015/11/14 Version 1.3.0 | ||
- opts.showDotFiles allows hiding dot files | ||
2015/11/03 Version 1.2.0 | ||
@@ -2,0 +5,0 @@ - opts.cache supports function argument |
{ | ||
"autoIndex": [ "autoIndex", "autoindex" ], | ||
"showDir": [ "showDir", "showdir" ], | ||
"showDotfiles": ["showDotfiles", "showdotfiles"], | ||
"humanReadable": [ "humanReadable", "humanreadable", "human-readable" ], | ||
@@ -5,0 +6,0 @@ "si": [ "si", "index" ], |
{ | ||
"autoIndex": true, | ||
"showDir": true, | ||
"showDotfiles": true, | ||
"humanReadable": true, | ||
@@ -5,0 +6,0 @@ "si": false, |
@@ -9,2 +9,3 @@ // This is so you can have options aliasing and defaults in one place. | ||
showDir = defaults.showDir, | ||
showDotfiles = defaults.showDotfiles, | ||
humanReadable = defaults.humanReadable, | ||
@@ -43,2 +44,9 @@ si = defaults.si, | ||
aliases.showDotfiles.some(function (k) { | ||
if (isDeclared(k)) { | ||
showDotfiles = opts[k]; | ||
return true; | ||
} | ||
}); | ||
aliases.humanReadable.some(function (k) { | ||
@@ -159,2 +167,3 @@ if (isDeclared(k)) { | ||
showDir: showDir, | ||
showDotfiles: showDotfiles, | ||
humanReadable: humanReadable, | ||
@@ -161,0 +170,0 @@ si: si, |
@@ -16,2 +16,3 @@ var ecstatic = require('../ecstatic'), | ||
handleError = opts.handleError, | ||
showDotfiles = opts.showDotfiles, | ||
si = opts.si, | ||
@@ -44,2 +45,10 @@ weakEtags = opts.weakEtags; | ||
} | ||
// Optionally exclude dotfiles from directory listing. | ||
if (!showDotfiles) { | ||
files = files.filter(function(filename){ | ||
return filename.slice(0,1) !== '.'; | ||
}); | ||
} | ||
res.setHeader('content-type', 'text/html'); | ||
@@ -46,0 +55,0 @@ res.setHeader('etag', etag(stat, weakEtags)); |
@@ -5,3 +5,3 @@ { | ||
"description": "A simple static file server middleware that works with both Express and Flatiron", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"homepage": "https://github.com/jfhbrook/node-ecstatic", | ||
@@ -8,0 +8,0 @@ "repository": { |
@@ -108,2 +108,6 @@ # Ecstatic [![build status](https://secure.travis-ci.org/jfhbrook/node-ecstatic.png)](http://travis-ci.org/jfhbrook/node-ecstatic) | ||
### `opts.showDotfiles` | ||
Exclude dotfiles from directory listings with `opts.showDotfiles === false`. Defaults to **true**. | ||
### `opts.humanReadable` | ||
@@ -110,0 +114,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
240974
840
228
23