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

@woz-scratch/tplink-ipc-sdk

v0.0.1

Published

TP-Link IPC Camera SDK - Authentication and Lens Mask Control

Readme

@woz-scratch/tplink-ipc-sdk

TP-Link 摄像头 JS SDK,支持认证登录和镜头遮蔽控制。

安装

npm install @woz-scratch/tplink-ipc-sdk

或直接引用本地路径:

{
  "dependencies": {
    "@woz-scratch/tplink-ipc-sdk": "file:../hass-tplink-ipc/js-sdk"
  }
}

使用

import { TPLinkIPCApiClient } from '@woz-scratch/tplink-ipc-sdk'

const client = new TPLinkIPCApiClient('192.168.1.100', 'admin', 'your_password')

// 查询遮蔽状态
const isMasked = await client.getLensMaskStatus()
console.log(isMasked) // true: 已遮蔽, false: 未遮蔽

// 开启遮蔽(隐私模式,镜头被遮挡)
await client.setLensMaskOn()

// 关闭遮蔽(恢复正常拍摄)
await client.setLensMaskOff()

// 同步摄像头时间
await client.syncTime()

API

new TPLinkIPCApiClient(host, username, password)

| 参数 | 类型 | 说明 | |------|------|------| | host | string | 摄像头 IP 地址,不含 http:// | | username | string | 用户名,通常为 admin | | password | string | 密码 |

方法

| 方法 | 返回值 | 说明 | |------|--------|------| | getLensMaskStatus() | Promise<boolean> | 查询遮蔽状态,true 为已遮蔽 | | setLensMaskOn() | Promise<object> | 开启遮蔽 | | setLensMaskOff() | Promise<object> | 关闭遮蔽 | | syncTime() | Promise<object> | 同步摄像头时间为当前系统时间 |

错误处理

import { TPLinkIPCApiClient, TPIPCApiError } from '@woz-scratch/tplink-ipc-sdk'

try {
  await client.setLensMaskOn()
} catch (err) {
  if (err instanceof TPIPCApiError) {
    console.error('API 错误:', err.message)
    console.error('错误码:', err.errorCode)
  }
}

CLI

项目内也提供了命令行工具,需要配置 .env 文件:

cp .env.example .env
# 编辑 .env 填入 TPLINK_HOST、TPLINK_USERNAME、TPLINK_PASSWORD
# 查看遮蔽状态
node src/cli.js status

# 开启遮蔽
node src/cli.js on

# 关闭遮蔽
node src/cli.js off

或通过 npm scripts:

npm run mask:status
npm run mask:on
npm run mask:off

测试

npm install

# 单元测试(不需要设备)
npm run test:auth

# 集成测试(需要 .env 配置真实设备信息)
npm run test:api

# 全部测试
npm test

依赖

| 包 | 用途 | |----|------| | node-forge | RSA 加密、MD5、ASN.1 解析 | | axios | HTTP 请求 |