Gathering detailed insights and metrics for serve-index
Gathering detailed insights and metrics for serve-index
Gathering detailed insights and metrics for serve-index
Gathering detailed insights and metrics for serve-index
npm install serve-index
Typescript
Module System
Min. Node Version
Node Version
NPM Version
JavaScript (85.02%)
CSS (9.64%)
HTML (5.34%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
445 Stars
393 Commits
155 Forks
19 Watchers
6 Branches
34 Contributors
Updated on Jun 15, 2025
Latest Version
1.9.1
Package Id
serve-index@1.9.1
Size
62.28 kB
NPM Version
3.10.10
Node Version
6.11.1
Published on
Sep 29, 2017
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
Serves pages that contain directory listings for a given path.
This is a Node.js module available through the
npm registry. Installation is done using the
npm install
command:
1$ npm install serve-index
1var serveIndex = require('serve-index')
Returns middlware that serves an index of the directory in the given path
.
The path
is based off the req.url
value, so a req.url
of '/some/dir
with a path
of 'public'
will look at 'public/some/dir'
. If you are using
something like express
, you can change the URL "base" with app.use
(see
the express example).
Serve index accepts these properties in the options object.
Apply this filter function to files. Defaults to false
. The filter
function
is called for each file, with the signature filter(filename, index, files, dir)
where filename
is the name of the file, index
is the array index, files
is
the array of files and dir
is the absolute path the file is located (and thus,
the directory the listing is for).
Display hidden (dot) files. Defaults to false
.
Display icons. Defaults to false
.
Optional path to a CSS stylesheet. Defaults to a built-in stylesheet.
Optional path to an HTML template or a function that will render a HTML string. Defaults to a built-in template.
When given a string, the string is used as a file path to load and then the following tokens are replaced in templates:
{directory}
with the name of the directory.{files}
with the HTML of an unordered list of file links.{linked-path}
with the HTML of a link to the directory.{style}
with the specified stylesheet and embedded images.When given as a function, the function is called as template(locals, callback)
and it needs to invoke callback(error, htmlString)
. The following are the
provided locals:
directory
is the directory being displayed (where /
is the root).displayIcons
is a Boolean for if icons should be rendered or not.fileList
is a sorted array of files in the directory. The array contains
objects with the following properties:
name
is the relative name for the file.stat
is a fs.Stats
object for the file.path
is the full filesystem path to directory
.style
is the default stylesheet or the contents of the stylesheet
option.viewName
is the view name provided by the view
option.Display mode. tiles
and details
are available. Defaults to tiles
.
1var finalhandler = require('finalhandler') 2var http = require('http') 3var serveIndex = require('serve-index') 4var serveStatic = require('serve-static') 5 6// Serve directory indexes for public/ftp folder (with icons) 7var index = serveIndex('public/ftp', {'icons': true}) 8 9// Serve up public/ftp folder files 10var serve = serveStatic('public/ftp') 11 12// Create server 13var server = http.createServer(function onRequest(req, res){ 14 var done = finalhandler(req, res) 15 serve(req, res, function onNext(err) { 16 if (err) return done(err) 17 index(req, res, done) 18 }) 19}) 20 21// Listen 22server.listen(3000)
1var express = require('express') 2var serveIndex = require('serve-index') 3 4var app = express() 5 6// Serve URLs like /ftp/thing as public/ftp/thing 7// The express.static serves the file contents 8// The serveIndex is this module serving the directory 9app.use('/ftp', express.static('public/ftp'), serveIndex('public/ftp', {'icons': true})) 10 11// Listen 12app.listen(3000)
6.1/10
Summary
Cross-Site Scripting in serve-index
Affected Versions
< 1.6.3
Patched Versions
1.6.3
Reason
no dangerous workflow patterns detected
Reason
GitHub workflow tokens follow principle of least privilege
Details
Reason
update tool detected
Details
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
security policy file detected
Details
Reason
project has 6 contributing companies or organizations
Details
Reason
SAST tool detected but not run on all commits
Details
Reason
dependency not pinned by hash detected -- score normalized to 7
Details
Reason
6 out of 9 merged PRs checked by a CI test -- score normalized to 6
Reason
7 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 5
Reason
Found 4/26 approved changesets -- score normalized to 1
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2025-07-14T21:24:59Z
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More