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

@yang0/iconfont-cli

v0.1.0

Published

API-first CLI for authenticated iconfont.cn workflows

Readme

iconfont-cli

English

通过命令行使用 iconfont.cn

iconfont-cli 是一个 API-first 的 iconfont.cn 命令行工具,支持登录态校验、素材搜索、素材集查看、SVG 下载、项目查看、CDN 查询和 ZIP 导出。

安装

1. 先安装 Bun

这个包会通过 npm 分发,但运行时仍然依赖 Bun

先安装 Bun:

powershell -c "irm bun.sh/install.ps1 | iex"

或者查看官方安装文档:https://bun.sh/docs/installation

2. 通过 npm 安装 CLI

计划使用的包名:

npm install -g @yang0/iconfont-cli

安装完成后运行:

iconfont --help

能做什么

  • 校验 cookie 登录态
  • 搜索插画和贴纸类素材集
  • --free-only 过滤 collection 搜索结果
  • 查看素材集详情与素材列表
  • 下载单个 SVG
  • 批量下载整个素材集的 SVG
  • 查看项目详情
  • 查询项目 CDN 信息
  • 下载项目 ZIP 包

快速开始

校验登录态

iconfont auth --cookie-file "G:\cookies\iconfont.txt" --format json

搜索免费素材

iconfont search 电商 贴纸 彩色 --cookie-file "G:\cookies\iconfont.txt" --free-only

查看素材集

iconfont collection inspect 33904 --cookie-file "G:\cookies\iconfont.txt"

下载单个 SVG

iconfont collection download 33904 220319 --cookie-file "G:\cookies\iconfont.txt"

批量下载素材集 SVG

iconfont collection download-all 33904 --cookie-file "G:\cookies\iconfont.txt"

查看项目

iconfont project inspect 2935321 --cookie-file "G:\cookies\iconfont.txt"

命令说明

auth

iconfont auth --cookie-file <path> [--ctoken <token>] [--format text|json]

search

iconfont search <query> --cookie-file <path> [--scope collections|items] [--collection-type illustration|illustration_3d] [--page <n>] [--page-size <n>] [--sort <value>] [--free-only] [--ctoken <token>] [--format text|json]

说明:

  • 多个位置参数会自动拼成一个搜索词
  • --free-only 目前只对 collection 搜索生效
  • collection 结果会在本地做多关键词聚合、去重和排序

collection inspect

iconfont collection inspect <collectionId> --cookie-file <path> [--type illustration|illustration_3d] [--ctoken <token>] [--format text|json]

collection download

iconfont collection download <collectionId> <assetId> --cookie-file <path> [--type illustration|illustration_3d] [--out <svg>] [--force] [--ctoken <token>] [--format text|json]

会使用素材的 origin_file 下载 SVG。

collection download-all

iconfont collection download-all <collectionId> --cookie-file <path> [--type illustration|illustration_3d] [--out-dir <dir>] [--force] [--ctoken <token>] [--format text|json]

会下载素材集中所有带 origin_file 的 SVG。

project inspect

iconfont project inspect <projectId> --cookie-file <path> [--ctoken <token>] [--format text|json]

project cdn

iconfont project cdn <projectId> --cookie-file <path> [--ctoken <token>] [--format text|json]

project download

iconfont project download <projectId> --cookie-file <path> [--ctoken <token>] [--out <zip>] [--force] [--format text|json]

Cookie 文件格式

认证依赖 Netscape cookie jar 格式文件。

典型流程:

  1. 在浏览器中登录 iconfont.cn
  2. 导出 Netscape 格式 cookies
  3. 将文件路径传给 --cookie-file

运行说明

  • npm 负责安装包并暴露 iconfont 命令
  • 命令启动器会再调用 Bun 执行 CLI
  • 因此 Bun 必须已经在 PATH 中可用
  • 如果没有安装 Bun,启动器会给出安装提示并退出

开发

bun install
bun run check
bun run index.ts --help
node ./bin/iconfont.js --help

发布

当前按以下方式准备:

npm publish --access public

发布前请确认:

  • 已执行 npm login
  • 目标包名可用
  • 本机已安装 Bun

License

MIT