npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@iocium/favicon-fetcher

v1.5.0

Published

Favicon and BIMI logo fetcher for Cloudflare Workers and browser-compatible environments

Readme

@iocium/favicon-fetcher

npm build codecov npm downloads bundle size types license

A simple TypeScript utility for fetching favicons and BIMI logos from major providers, compatible with Cloudflare Workers, modern browsers, and Node.js.

Install

npm install @iocium/favicon-fetcher

Usage

import { FaviconFetcher } from '@iocium/favicon-fetcher';

const fetcher = new FaviconFetcher('github.com', {
  iconHorseApiKey: 'your-api-key-here'
});
const result = await fetcher.fetchFavicon('iconHorse');

console.log(result.status, result.contentType);

Providers

  • Google
  • DuckDuckGo
  • Bitwarden
  • Yandex
  • Fastmail
  • icon.horse (Pro support via X-API-Key)
  • NextDNS
  • Iocium
  • favicon.is
  • favicon.im
  • ControlD (via favicon.controld.com)
  • BIMI (via DNS TXT record lookup)

Configuration

useCorsProxy

Use this option to fetch through a CORS proxy when running in a browser:

new FaviconFetcher('github.com', {
  useCorsProxy: true // uses https://corsproxy.io/?
});

new FaviconFetcher('github.com', {
  useCorsProxy: 'https://my-cors-proxy/'
});

iconHorseApiKey

Use this to authenticate with icon.horse Pro.

new FaviconFetcher('github.com', {
  iconHorseApiKey: 'your-api-key'
});

This will override any X-API-Key passed manually in headers.

headers

Set custom headers for fetch requests. Useful for user-agent tagging or auth with custom endpoints:

new FaviconFetcher('example.com', {
  headers: {
    'User-Agent': 'MyFaviconBot/1.0'
  }
});

Note: X-API-Key will be overridden if using iconHorseApiKey.

dohServerUrl

Override the DNS-over-HTTPS server used for BIMI lookups (default: Cloudflare):

new FaviconFetcher('paypal.com', {
  dohServerUrl: 'https://dns.google/dns-query'
});

Advanced Examples

🔹 Fetching a BIMI logo (SVG)

const fetcher = new FaviconFetcher('paypal.com');
const result = await fetcher.fetchFavicon('bimi');

console.log(result.url);         // BIMI logo URL from TXT record
console.log(result.status);      // 200 if success
console.log(result.contentType); // image/svg+xml
console.log(result.content);     // ArrayBuffer (SVG image)

🔹 Using a custom DoH server for BIMI

By default, BIMI lookups use Cloudflare's DoH endpoint, but you can override this if you prefer another provider like Google or NextDNS:

const fetcher = new FaviconFetcher('paypal.com', {
  dohServerUrl: 'https://dns.google/dns-query'
});
const result = await fetcher.fetchFavicon('bimi');

Supported DoH endpoints:

  • Cloudflare: https://cloudflare-dns.com/dns-query (default)
  • Google: https://dns.google/dns-query
  • NextDNS: https://dns.nextdns.io/YOUR_PROFILE_ID

⚠️ Ensure the DoH server supports application/dns-json responses (RFC 8484 JSON mode). No validation is performed on this URL — garbage in, garbage out.


🔹 Combining options: icon.horse Pro, custom headers, and CORS proxy

const fetcher = new FaviconFetcher('github.com', {
  iconHorseApiKey: 'your-real-api-key',
  useCorsProxy: 'https://my-cors-proxy/',
  headers: {
    'User-Agent': 'FaviconFetcherBot/2.0'
  }
});
const result = await fetcher.fetchFavicon('iconHorse');

Testing

npm test         # Runs mocked tests
npm run test:live  # Runs real network integration tests (LIVE_TEST=true)

License

MIT