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

iconfont-script

v0.2.3

Published

iconfont script 实现下载iconfont网站zip文件,并解压指定目录,避免项目开发前期繁琐操作

Readme

iconfont-script

iconfont-script

简介

项目中采用iconfont去管理UI设计图标,由于... . . 等原因,图标并不是一次性给到前端的。 有新的图标就要到iconfont网站进行下载加压到本地,是不是感觉这样很不爽?

安装

npm install iconfont-script

使用

```javascript
/**
 * @author 🌈先知云 <[email protected]>
 * @date ⌚2020-05-18
 * @desc 📝 下载远程iconfont 内容
 */
const path = require('path')
const {iconfontScript} = require('iconfont-script');
const iconConfig = {
    cookie: 'xxxx',
    list: [
        {
            url: 'https://www.iconfont.cn/api/project/download.zip?spm=a313x.7781069.1998910419.d7543c303&pid=724179&ctoken=19DKMjRBi14qCZ3dibnLdK5n',
            toPath: path.join(__dirname, '../src/assets/iconfont/features')
        },
        {
            url: 'https://www.iconfont.cn/api/project/download.zip?spm=a313x.7781069.1998910419.d7543c303&pid=724179&ctoken=19DKMjRBi14qCZ3dibnLdK5n',
            toPath: path.join(__dirname, '../src/assets/iconfont/menu'),
            replaceName: 'iconfont-menu',
        }
    ]
}
;(async () => {
    await iconfontScript(iconConfig)
})()
```

实现思路

1. 获取buffer 2. buffer写入本地 *iconfont. zip* 3. iconfont. zip进行解压到 *iconfont* 文件夹 4. 将解压后文件进行迁移到指定目录 5. 将本地生成文件和文件夹 *iconfont. zip*、iconfont删除

🛠工具

常用工具据不一一描述了,自行查找他们使用方法,具体如何骚。

rollup

nodemon

concurrently

request

发布工具

let options = {
    url: _url,
    encoding: null,
    headers: {
        'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11',
        'cookie': this.cookie
    },
    debug: false,
    maxRedirects: 5,
    // 禁止跳转,防SSRF
    followRedirect: false,
    timeout: 10000
}

Request 被废弃了, 几乎接触过Node的人都接触过Request。这里建议使用 superagent 轻量HTTP库。

compressing实现解压

jszip如何进行压缩文件进行参考

在Class中如何使用递归?

deleteFolderRecursive删除文件和文件夹

概念

  • Buffer
    • JavaScript 语言自身只有字符串数据类型,没有二进制数据类型。定义了一个 Buffer 类,该类用来创建一个专门存放二进制数据的缓存区。

最后

面试题

  1. request中 encoding:null headers中User-Agent?
  2. Buffer、Uint8Array、base64编码、Blob 这几个常用概念理解,什么场景先使用?
  3. 浅谈CSRF、SSRF理解?
  4. call、apply、bind应用?
  5. 在webpack中经常看到path.join和path.resolve区别是什么?
  6. 使用fs的同步方法,javascript 宏任务与微任务的解读eventLoop?
  7. 浏览器端和服务端如何实现一个文件上传和下载,如何实现大文件上传?
  8. forEach、map、for 循环过程中异步等待(async, await)有什么不同?
  9. 递归实现有几种方式,项目开发过程中哪些场景使用?
  10. 服务端如何防止网络爬虫,有哪些方式?

postversion  自动打标签并发布

更多推荐

记一次node爬虫经历,手把手教你爬虫

参考资料

nodejs中文网 Node. js 不深也不浅得了解下编码 都 2020 年了,你还在手动发布 npm 包吗 持续集成(Travis CI)运行流程详解 基于travis和git tag 实现npm自动化发版 使用 Travis CI 自动发布 npm