favicon-fetch
This package quickly gives you a URL for any website's favicon.
Uses the Icon Horse service to fetch the icon.
Installing
npm install favicon-fetch
or:
yarn add favicon-fetch
Basic usage
const faviconFetch = require('favicon-fetch')
import faviconFetch from 'favicon-fetch'
faviconFetch({ hostname: 'wikipedia.org' })
faviconFetch({ uri: 'https://en.wikipedia.org/wiki/1986' })
The icon returned looks like this:
![Wikipedia icon](https://icon.horse/icon/wikipedia.org)
Additional options
Currently, both the fallback functionality and the size
param require an apikey
(read about getting one here).
faviconFetch({
size: 'small|medium|big',
fallbackText: 'FFFFFF',
fallbackBg: '000000',
apikey: ''
})