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

@junpenn/screenshot-cli

v0.1.2

Published

Local website screenshots and favicons using your installed browser

Readme

@junpenn/screenshot-cli

English | 简体中文

使用本机 Chrome/Chromium 截取网页、获取 favicon,支持 PNG、JPEG、WebP 和 JSON 输出。

需要 Node.js 22.12+,以及已安装的 Chrome/Chromium。

安装

npm i @junpenn/screenshot-cli
npx screenshot-cli --help

也可以直接运行:npx @junpenn/screenshot-cli --help。

使用

# 截图
npx screenshot-cli screenshot https://example.com \
  -o ./output/preview.webp --width 1600 --height 900 --clean

# 获取 favicon,自动保留原始图标格式
npx screenshot-cli favicon https://www.wikipedia.org \
  --output-dir ./output/icons

# 同时获取截图和 favicon
npx screenshot-cli capture https://www.wikipedia.org \
  --output-dir ./output/wikipedia --json

已有文件默认不覆盖,添加 --force 可覆盖。

常用参数

| 参数 | 说明 | | --- | --- | | -o, --output | 单文件路径,不适用于 capture | | --output-dir | 输出目录,默认 ./output | | --format | png / jpeg / webp,默认 png;截图可由输出扩展名推断 | | --width / --height | 视口尺寸,默认 1600 × 900 | | --quality | JPEG/WebP 质量,默认 85 | | --full-page | 整页截图 | | --clean | 隐藏常见弹层和聊天挂件,停止 CSS 动画 | | --hide | 隐藏指定 CSS 选择器,可重复 | | --wait-for | 等待指定元素可见,可重复 | | --delay | 额外等待毫秒数,默认 500 | | --timeout | 超时毫秒数,默认 30000 | | --headed | 显示浏览器窗口 | | --wait-for-enter | 手动操作后回车继续,需要 --headed 和交互式终端 | | --browser-path | 浏览器可执行文件路径,也可设置 BROWSER_PATH | | --user-data-dir | 复用专用浏览器配置目录 | | --force | 覆盖已有文件 | | --json | 输出文件路径、图片尺寸和错误等 JSON 信息 |

--clean 仅匹配常见组件,其他元素可通过 --hide 指定。整页截图不会自动触发所有懒加载内容。

有头模式

npx screenshot-cli screenshot https://example.com \
  --headed --wait-for-enter --user-data-dir ./profiles/demo \
  -o ./output/manual.png

JSON 输出

--json 返回 success、screenshot、favicon 和 errors 等字段;图片结果包含绝对路径、格式、尺寸及字节数。

退出码:0 全部成功,1 失败。capture 部分失败时保留已生成的文件,并返回非零退出码。