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

hdc-node

v0.1.3

Published

Node.js implementation of OpenHarmony HDC (Host Device Connector)

Readme

hdc-node

OpenHarmony HDC (Harmony Device Connector) 的 Node.js 实现 —— HarmonyOS / OpenHarmony 设备的调试与文件传输工具。

English

安装

npm install -g hdc-node

安装后即可使用 hdc 命令:

hdc list targets

前置条件: Node.js >= 18。USB 设备发现需要同时安装官方 HDC SDK(hdc-node 会自动检测并使用)。

常用命令

hdc list targets              # 列出已连接设备
hdc shell                     # 交互式 Shell
hdc shell ls /data/local/tmp  # 执行单条命令
hdc file send ./app.hap /data/local/tmp/  # 推送文件
hdc file recv /data/log.txt               # 拉取文件到当前目录
hdc file recv /data/log.txt ./            # 指定本地路径
hdc install /path/to/app.hap  # 安装应用
hdc uninstall com.example.app # 卸载应用
hdc fport tcp:8080 tcp:8080   # 端口转发
hdc hilog                     # 查看设备日志
hdc start                     # 启动服务端
hdc kill                      # 停止服务端
hdc kill -r                   # 停止并重启服务端

编程接口

import { HdcClient } from 'hdc-node';

const client = new HdcClient({ host: '127.0.0.1', port: 8710 });
await client.connect();

const result = await client.executeCommand('shell ls /data/local/tmp');
console.log(result);

await client.disconnect();

支持的命令

| 命令 | 说明 | |------|------| | shell [cmd] | 交互式或单次 Shell | | list targets | 列出已连接设备 | | file send/recv | 文件传输 | | install/uninstall | 应用安装/卸载 | | fport/rport | 端口转发 | | hilog | 设备日志查看 | | tconn | TCP 设备连接 | | tmode | 切换 USB/TCP 模式 | | smode | 切换 Root 模式 | | target boot | 重启设备 | | keygen | 生成 RSA 密钥对 | | start/kill | 服务端管理 |

工作原理

hdc-node 采用与官方 HDC 工具相同的客户端-服务端架构:

[hdc CLI] --TCP 通道--> [HDC 服务端] --USB/TCP 会话--> [设备守护进程]
  • 客户端hdc 命令)通过 TCP 端口 8710 连接服务端
  • 服务端发现 USB 设备并维护与设备守护进程的会话
  • 当官方 hdc 工具在 PATH 中时,hdc-node 自动使用官方服务端进行 USB 设备发现

相关链接

许可证

Apache-2.0