@tinyhttp/favicon
TypeScript icon, indicating that this package has built-in type declarations

3.0.0 • Public • Published

A rewrite of serve-favicon module.

Node.js middleware to serve favicon.ico file.

Install

pnpm i @tinyhttp/favicon

API

import { favicon } from '@tinyhttp/favicon'

Options

favicon accepts these properties in the options object.

path

Path to icon, required. Passed as the first argument.

maxAge

Sets Cache-Control: maxAge= header, optional. Default is one year. Passed with object in the second argument.

Example

import { favicon } from '@tinyhttp/favicon'
import { createServer } from 'node:http'
import path from 'node:path'

createServer(favicon(path.join(process.cwd(), 'public', 'favicon.ico')).listen(3000)

Package Sidebar

Install

npm i @tinyhttp/favicon

Weekly Downloads

2

Version

3.0.0

License

MIT

Unpacked Size

8.6 kB

Total Files

5

Last publish

Collaborators

  • dropthebeatbro