← 返回
开发者工具 中文

favicon-so

favicon.so project API reference — covers the favicon fetch API and image-to-favicon-package convert API. Use when working on API routes, building integratio...
favicon.so 项目 API 参考,涵盖 favicon 获取 API 及图片转 favicon 包 API。适用于处理 API 路由或构建集成...
go7hic
开发者工具 clawhub v1.0.0 1 版本 100000 Key: 无需
★ 0
Stars
📥 478
下载
💾 15
安装
1
版本
#latest

概述

favicon.so API

API 1: Favicon Fetch

Fetch any website's favicon by domain.

Endpoints

MethodPathDescription
---------------------------
GET/api/favicon?url={domain}Fetch favicon with full options
GET/{domain}Short URL, returns favicon image directly

Parameters

ParamTypeRequiredDescription
------------------------------------
urlstringyesDomain or URL (e.g. github.com)
rawstringnoSet to "true" for JSON metadata instead of image

Response Modes

Image mode (default):

Returns binary image data with headers:

  • Content-Type: actual image MIME type
  • Cache-Control: public, max-age=604800
  • Access-Control-Allow-Origin: *

JSON mode (raw=true):

{
  "url": "https://github.githubassets.com/favicons/favicon.svg",
  "format": "image/svg+xml",
  "isDefault": false
}

Implementation

  • Source: app/api/favicon/route.ts and app/[locale]/[domain]/route.ts
  • Core logic: lib/fetchFavicon.ts — tries HTML parsing, /favicon.ico, Google, DuckDuckGo fallbacks
  • Domain validation: lib/utils.tsnormalizeDomain(), isValidDomain()
  • Falls back to a default SVG icon when all sources fail

API 2: Image Convert

Convert any image into a complete favicon package with all sizes.

Endpoint

MethodPathDescription
---------------------------
POST/api/convertUpload image, get favicon package

Request

Content-Type: multipart/form-data

FieldTypeRequiredDescription
------------------------------------
imageFileyesImage file (PNG, JPG, WebP, GIF, BMP, TIFF)

Also accepts raw image bytes with Content-Type: image/* or application/octet-stream.

Query Parameters

ParamTypeDefaultDescription
-----------------------------------
formatstringSet to "json" for base64 JSON output instead of ZIP

Response

ZIP mode (default):

Returns application/zip containing 10 files:

  • favicon.ico (multi-resolution: 16, 32, 48, 64, 128)
  • favicon-16x16.png, favicon-32x32.png, favicon-48x48.png, favicon-64x64.png, favicon-128x128.png
  • apple-touch-icon.png (180×180)
  • android-chrome-192x192.png, android-chrome-512x512.png
  • site.webmanifest

JSON mode (format=json):

{
  "files": {
    "favicon-16x16.png": { "size": 1234, "base64": "iVBOR..." },
    "favicon.ico": { "size": 5678, "base64": "AAAB..." },
    ...
  }
}

Implementation

  • Source: app/api/convert/route.ts
  • Image processing: jimp (pure JS, Cloudflare Workers compatible)
  • ICO generation: custom multi-resolution ICO builder
  • ZIP packaging: jszip
  • CORS enabled, no auth required

Architecture Notes

  • All API routes are in app/api/ and skip the i18n middleware
  • The [locale]/[domain]/route.ts catch-all serves as a short URL for favicon fetch
  • Reserved paths (search, convert, api, generator, skill, mcp) are excluded from the domain catch-all
  • Client-side convert page (app/[locale]/convert/page.tsx) uses WASM (Photon + resvg) for browser-native processing
  • Server-side convert API uses jimp for Node.js/Workers compatibility

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-03-30 02:44 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

developer-tools

Github

steipete
使用 `gh` CLI 与 GitHub 交互,通过 `gh issue`、`gh pr`、`gh run` 和 `gh api` 管理议题、PR、CI 运行及高级查询。
★ 667 📥 323,821
developer-tools

Agent Browser

matrixy
专为AI智能体优化的无头浏览器自动化CLI,支持无障碍树快照和基于引用的元素选择。
★ 425 📥 118,032
developer-tools

Gog

steipete
Google Workspace 命令行工具,支持 Gmail、日历、云端硬盘、通讯录、表格和文档。
★ 921 📥 185,734