Gathering detailed insights and metrics for serve-favicon
Gathering detailed insights and metrics for serve-favicon
Gathering detailed insights and metrics for serve-favicon
Gathering detailed insights and metrics for serve-favicon
npm install serve-favicon
Module System
Unable to determine the module system for this package.
Min. Node Version
Typescript Support
Node Version
NPM Version
619 Stars
210 Commits
73 Forks
20 Watching
2 Branches
30 Contributors
Updated on 13 Nov 2024
JavaScript (100%)
Cumulative downloads
Total Downloads
Last day
-8.1%
387,396
Compared to previous day
Last week
1.5%
2,213,747
Compared to previous week
Last month
4.8%
9,382,139
Compared to previous month
Last year
-46.3%
131,008,851
Compared to previous year
Node.js middleware for serving a favicon.
A favicon is a visual cue that client software, like browsers, use to identify a site. For an example and more information, please visit the Wikipedia article on favicons.
Why use this module?
favicon.ico
frequently and indiscriminately, so you
may wish to exclude these requests from your logs by using this middleware
before your logger middleware.ETag
based on the contents of the icon, rather
than file system properties.Content-Type
.Note This module is exclusively for serving the "default, implicit favicon",
which is GET /favicon.ico
. For additional vendor-specific icons that require
HTML markup, additional middleware is required to serve the relevant files, for
example serve-static.
This is a Node.js module available through the
npm registry. Installation is done using the
npm install
command:
1$ npm install serve-favicon
Create new middleware to serve a favicon from the given path
to a favicon file.
path
may also be a Buffer
of the icon to serve.
Serve favicon accepts these properties in the options object.
The cache-control
max-age
directive in ms
, defaulting to 1 year. This can
also be a string accepted by the ms
module.
Typically this middleware will come very early in your stack (maybe even first)
to avoid processing any other middleware if we already know the request is for
/favicon.ico
.
1var express = require('express') 2var favicon = require('serve-favicon') 3var path = require('path') 4 5var app = express() 6app.use(favicon(path.join(__dirname, 'public', 'favicon.ico'))) 7 8// Add your routes here, etc. 9 10app.listen(3000)
1var connect = require('connect') 2var favicon = require('serve-favicon') 3var path = require('path') 4 5var app = connect() 6app.use(favicon(path.join(__dirname, 'public', 'favicon.ico'))) 7 8// Add your middleware here, etc. 9 10app.listen(3000)
This middleware can be used anywhere, even outside express/connect. It takes
req
, res
, and callback
.
1var http = require('http') 2var favicon = require('serve-favicon') 3var finalhandler = require('finalhandler') 4var path = require('path') 5 6var _favicon = favicon(path.join(__dirname, 'public', 'favicon.ico')) 7 8var server = http.createServer(function onRequest (req, res) { 9 var done = finalhandler(req, res) 10 11 _favicon(req, res, function onNext (err) { 12 if (err) return done(err) 13 14 // continue to process the request here, etc. 15 16 res.statusCode = 404 17 res.end('oops') 18 }) 19}) 20 21server.listen(3000)
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
6 different organizations found -- score normalized to 10
Details
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
Reason
no vulnerabilities detected
Reason
dependency not pinned by hash detected -- score normalized to 2
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
0 out of 2 merged PRs checked by a CI test -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
found 28 unreviewed changesets out of 30 -- score normalized to 0
Reason
no update tool detected
Details
Reason
project is not fuzzed
Details
Reason
0 commit(s) out of 30 and 0 issue activity out of 30 found in the last 90 days -- score normalized to 0
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
security policy file not detected
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Score
Last Scanned on 2024-11-25T21:23:16Z
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