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

@bomon/nestjs-cct-explorer

v2.0.2

Published

NestJS 模块:封装 CDP client 的设备资源浏览器 HTTP 接口与 /browser 页面

Downloads

347

Readme

@bomon/nestjs-cct-explorer

NestJS 模块:为 CDP Client 网关提供设备资源浏览器 HTTP 接口与 /browser 页面。

English · README (English)

安装

pnpm add @bomon/nestjs-cct-explorer
# 或
npm i @bomon/nestjs-cct-explorer

使用

  1. 在你的网关项目中实现 DeviceGateway 接口(例如基于 Socket.IO 转发到设备)。
  2. 在根模块中通过 forRoot 传入你的网关类(需实现 DeviceGateway):
import { Module } from '@nestjs/common';
import { CctExplorerModule } from '@bomon/nestjs-cct-explorer';
import { SocketIoDeviceGateway } from './socket-io-device.gateway'; // 你的实现

@Module({
  imports: [
    CctExplorerModule.forRoot({
      deviceGatewayClass: SocketIoDeviceGateway, // 必填
      pathPrefix: '', // 可选,例如 'cct' 时需配合挂载路径
      scriptQueuePollIntervalMs: 1000, // 可选,默认 1000。模块内定时向所有设备拉取 script_queue 并缓存,GET devices 会带上 scriptQueue/queueUpdatedAt/queueError;设为 0 则关闭轮询
    }),
  ],
})
export class AppModule {}
  1. 若使用全局前缀(如 setGlobalPrefix('cct')),则访问 http://localhost:3000/cct/browser,页面内 API 使用相对路径,会自动请求 /cct/devices/cct/fs/* 等。

路由

| 路径 | 方法 | 说明 | |------|------|------| | /browser/browser/ | GET | 资源浏览器单页(Vite + React 构建,由 ServeStaticModule 提供) | | /devices | GET | 设备列表。当 scriptQueuePollIntervalMs > 0 且网关实现 getScriptQueue 时,每个设备会附带 scriptQueuequeueUpdatedAtqueueError(模块内定时轮询各设备并缓存) | | /scripts/queue | GET | 单设备脚本队列:?device=设备名,返回 { running, pending, capacity }(有缓存时优先返回缓存,需网关实现 getScriptQueue) | | /scripts/interrupt | POST | 中断运行中脚本:{ device, jobId },需网关实现 interruptScript | | /scripts/undo | POST | 撤销排队/运行中任务:{ device, jobId },需网关实现 undoScript | | /fs/dir | GET | 读目录 | | /fs/file | GET | 读文件 | | /fs/file | DELETE | 删文件 | | /fs/file | POST | 写文件(需网关实现 writeFile) |

依赖

需实现并注入 DeviceGateway(见包内 device-gateway.interface.ts)。若需资源浏览器中的「脚本队列」展示,需实现可选方法 getScriptQueue(device: string): Promise<ScriptQueueSnapshot>。若需「中断」「撤销」按钮,需实现 interruptScriptundoScript

构建

构建时会执行 tscvite build,将 React 前端输出到 dist/public/browser/。发布包时需包含 dist 目录。