Skip to content

Favicon fetcher finds favicons and flawlessly fetches them fast

License

Notifications You must be signed in to change notification settings

victrme/favicon-fetcher

Repository files navigation

favicon fetcher

Favicon fetcher finds sites favicons and fetches them fast

Test it here: https://favicon.victr.me

Install

npm i @victr/favicon-fetcher

Example use

import favicon from '@victr/favicon-fetcher'

window.onload = async function () {
  const img = document.getElementById('some-id')
  const url = await favicon.url('https://github.com')

  img.src = url
}

Export type

export default {
  url: (query: string) => Promise<string>,
  img: (query: string) => Promise<Blob>,
}

As API

Endpoints

Protocols need to be included in the :url query. You can get your favicon as a plaintext url or a blob:

GET /text/:url
GET /blob/:url

Cloudflare Workers

# install
pnpm install

# debug
pnpm dev