Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
Generated on May 1, 2024 via pnpm

serve-favicon 2.3.2

favicon serving middleware with caching
Package summary
Share
2
issues
1
high severity
vulnerability
1
1
moderate severity
vulnerability
1
1
license
5
MIT
Package created
2 May 2014
Version published
17 Nov 2016
Maintainers
1
Total deps
5
Direct deps
4
License
MIT

Issues

2

1 high severity issue

high
Recommendation: Upgrade to version 0.5.2 or later
via: fresh@0.3.0
Collapse
Expand

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
5 Packages, Including:
etag@1.7.0
fresh@0.3.0
ms@0.7.2
parseurl@1.3.3
serve-favicon@2.3.2
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

4
All Dependencies CSV
β“˜ This is a list of serve-favicon 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities
etag1.7.03.89 kBMIT
prod
fresh0.3.02.41 kBMIT
prod
1
ms0.7.22.81 kBMIT
prod
1
parseurl1.3.33.86 kBMIT
prod

Visualizations

Frequently Asked Questions

What does serve-favicon do?

Serve-favicon is designed as a middleware for Node.js, which specifically caters to serving a website's favorite icon - popularly known as a favicon. These favicons often appear in the address bar or tabs of your browser to help identify a site. Using serve-favicon not only aids in successful favicon delivery to end-users, but also significantly optimizes performance by caching the icon in memory, mitigating the need for repeated disk access. Moreover, serve-favicon ensures the delivery of the icon with an ETag based on its content, rather than file system properties, and presents it with the most compatible Content-Type.

How do you use serve-favicon?

To implement serve-favicon in your application, you must first integrate it into your project by installing it via the npm registry using the npm install command:

$ npm install serve-favicon

Here are three ways you can use serve-favicon:

Using Express:

var express = require('express')
var favicon = require('serve-favicon')
var path = require('path')

var app = express()
app.use(favicon(path.join(__dirname, 'public', 'favicon.ico')))

// Add your routes here.

app.listen(3000)

Using Connect:

var connect = require('connect')
var favicon = require('serve-favicon')
var path = require('path')

var app = connect()
app.use(favicon(path.join(__dirname, 'public', 'favicon.ico')))

// Add your middleware here.

app.listen(3000)

Using Vanilla HTTP Server:

var http = require('http')
var favicon = require('serve-favicon')
var finalhandler = require('finalhandler')
var path = require('path')

var _favicon = favicon(path.join(__dirname, 'public', 'favicon.ico'))

var server = http.createServer(function onRequest (req, res) {
  var done = finalhandler(req, res)

  _favicon(req, res, function onNext (err) {
    if (err) return done(err)

    // continue processing the request.

    res.statusCode = 404
    res.end('oops')
  })
})

server.listen(3000)

The favicon(path, options) function is used to establish the middleware. The path parameter describes the location of your favicon file, while options is an optional object parameter allowing you to set properties such as maxAge for cache-control.

Where are the serve-favicon docs?

For in-depth information and further usage examples, please refer to the serve-favicon documentation which is hosted on GitHub, at the given repository.