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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@bytecook/icons

v1.0.1

Published

Self-hosted icons CDN URL helpers - 6000+ icons with China CDN acceleration

Downloads

35

Readme

@bytecook/icons

自托管图标 CDN URL 工具库 - 6000+ 图标,中国大陆 CDN 加速

English | 中文

在线浏览

ico.bytecook.io - 在线浏览和搜索所有图标


基于 selfh.st/icons,一个为自托管服务和仪表板设计的综合图标集合。

官方包地址:jsdelivr.com/package/gh/selfhst/icons

安装

npm install @bytecook/icons
# or
pnpm add @bytecook/icons
# or
yarn add @bytecook/icons

使用方法

基础用法

import { createIconUrl } from '@bytecook/icons';

// 默认: SVG 格式, Peekabo CDN (中国加速)
createIconUrl('nginx');
// => https://ico.bytecook.io/svg/nginx.svg

// 指定格式
createIconUrl('nginx', { format: 'png' });
// => https://ico.bytecook.io/png/nginx.png

// 暗色/亮色变体
createIconUrl('nginx', { format: 'png', variant: 'dark' });
// => https://ico.bytecook.io/png/nginx-dark.png

// 使用 jsDelivr CDN (全球加速)
createIconUrl('nginx', { cdn: 'jsdelivr' });
// => https://cdn.jsdelivr.net/gh/selfhst/icons@main/svg/nginx.svg

// 自定义 CDN
createIconUrl('nginx', { cdn: 'https://my-cdn.com/icons' });
// => https://my-cdn.com/icons/svg/nginx.svg

工厂模式

import { createIconHelper } from '@bytecook/icons';

// 创建配置好的 helper
const icons = createIconHelper({
  format: 'webp',  // 默认格式
});

// 使用 helper
icons.url('docker');           // WebP 格式 (默认)
icons.svg('docker');           // 强制 SVG
icons.png('docker');           // 强制 PNG
icons.png('docker', 'dark');   // PNG 暗色变体
icons.webp('docker', 'light'); // WebP 亮色变体

默认 Helper

import { icons } from '@bytecook/icons';

// 预配置 Peekabo CDN 和 SVG 格式
icons.svg('nginx');
icons.png('nginx', 'dark');

图标元数据

import iconList from '@bytecook/icons/icons.json';

console.log(iconList.length); // 2360+ 图标

// 每个图标包含:
// {
//   name: "Nginx",
//   reference: "nginx",
//   category: "Web Server",
//   svg: true,
//   png: true,
//   webp: true,
//   light: true,
//   dark: true,
//   tags: ["web", "server", "proxy"]
// }

API 参考

createIconUrl(reference, options?)

创建完整的图标 URL。

| 参数 | 类型 | 描述 | |------|------|------| | reference | string | 图标引用/标识 (如 'nginx', 'docker') | | options.format | 'svg' \| 'png' \| 'webp' \| 'avif' \| 'ico' | 图片格式 (默认: 'svg') | | options.variant | '' \| 'light' \| 'dark' | 主题变体 (默认: '') | | options.cdn | 'bytecook' \| 'jsdelivr' \| string | CDN 源 (默认: 'bytecook') |

createIconHelper(config?)

创建配置好的图标 helper 实例。

| 参数 | 类型 | 描述 | |------|------|------| | config.baseUrl | string | 基础 CDN URL (默认: Peekabo CDN) | | config.format | IconFormat | 默认格式 (默认: 'svg') |

返回 IconHelper,包含以下方法:

  • url(reference, options?) - 使用当前配置获取 URL
  • svg(reference, variant?) - 获取 SVG URL
  • png(reference, variant?) - 获取 PNG URL
  • webp(reference, variant?) - 获取 WebP URL
  • avif(reference, variant?) - 获取 AVIF URL
  • ico(reference, variant?) - 获取 ICO URL

常量

import { BYTECOOK_CDN, JSDELIVR_CDN } from '@bytecook/icons';

BYTECOOK_CDN // 'https://ico.bytecook.io' (Peekabo CDN)
JSDELIVR_CDN // 'https://cdn.jsdelivr.net/gh/selfhst/icons@main'

CDN 节点

| CDN | URL | 描述 | |-----|-----|------| | Peekabo | https://ico.bytecook.io | 中国大陆加速 (默认) | | jsDelivr | https://cdn.jsdelivr.net/gh/selfhst/icons@main | 全球 CDN |

支持的格式

  • SVG - 可缩放矢量图形 (推荐)
  • PNG - 光栅图像
  • WebP - 现代格式,压缩率好
  • AVIF - 下一代格式,压缩率最佳
  • ICO - Windows 图标格式

图标变体

许多图标支持亮色和暗色变体:

  • 标准: nginx.svg
  • 亮色: nginx-light.svg
  • 暗色: nginx-dark.svg

相关链接