directory-index-html
Advanced tools
Comparing version 1.0.1 to 1.1.0
@@ -15,3 +15,3 @@ var http = require('http') | ||
function loop () { | ||
if (!files.length) return res.end(toHTML(dir, entries)) | ||
if (!files.length) return res.end(toHTML(dir, entries, 'Listing created with "node demo.js"')) | ||
@@ -18,0 +18,0 @@ var name = files.shift() |
@@ -26,3 +26,3 @@ var constants = require('cons' + 'tants') // be browserify friendly | ||
function toHTML (dir, list) { | ||
function toHTML (dir, list, footer) { | ||
if (dir[dir.length - 1] === '/') dir = dir.slice(0, -1) | ||
@@ -37,3 +37,3 @@ | ||
<head><title>Index of ${dirname}</title></head> | ||
<body bgcolor="white"><h1>Index of ${dirname}</h1><hr><pre>${pre}</pre><hr></body> | ||
<body bgcolor="white"><h1>Index of ${dirname}</h1><hr><pre>${pre}</pre><hr>${footer ? '<i>' + footer + '</i>' : ''}</body> | ||
</html> | ||
@@ -40,0 +40,0 @@ `) |
{ | ||
"name": "directory-index-html", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"description": "Make an plain html page containing a directory listing", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -29,3 +29,3 @@ # directory-index-html | ||
#### `var html = toHTML(dir, entries)` | ||
#### `var html = toHTML(dir, entries, [serverDescription])` | ||
@@ -52,2 +52,4 @@ Render a directory name and listing to an plain HTML string. | ||
`serverDescription` an optional string describing the server that is included at the bottom of your page | ||
## Demo | ||
@@ -54,0 +56,0 @@ |
238519
67