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

@whyun/tv-tools

v0.1.4

Published

TypeScript utilities for decoding TVBox JSON payloads

Downloads

887

Readme

@whyun/tv-tools

TypeScript 工具库,用于解码 TVBox 类配置 JSON:常见加密/编码载荷解密、带注释的 JSON 预处理,以及 TVBoxConfig 等类型定义。

要求

  • Node.js ≥ 20(使用 node:crypto
  • 模块:同时提供 ESM*.mjs)与 CommonJS*.cjs),入口见 package.jsonexports

安装

从 registry 安装(包名为作用域包):

pnpm add @whyun/tv-tools

在 monorepo 或本地路径引用:

pnpm add file:../tv-tools
# 或 workspace 协议等,按你的仓库约定

克隆本仓库开发时:

pnpm install
pnpm run build

用法

import {
  decodeTvboxJson,
  parseTvboxJson,
  type TVBoxConfig,
} from '@whyun/tv-tools';

// 解密/解码为字符串(已是合法 JSON 时原样返回)
const jsonText = decodeTvboxJson(raw, optionalConfigKey);

// 直接解析为对象(默认泛型为 TVBoxConfig)
const config = parseTvboxJson<TVBoxConfig>(raw, optionalConfigKey);

| API | 说明 | |-----|------| | decodeTvboxJson(input, configKey?) | 处理 Base64 前缀、特定 hex/CBC 流程;若传入 configKey 且内容为 hex 密文,则 AES-128-ECB 解密。 | | parseTvboxJson(input, configKey?) | 在解码后解析 JSON;会先去除 ///* */ 注释与 BOM,再 JSON.parse。 |

类型定义见源码 src/types.ts(如 TVBoxConfigSiteLive 等)。

脚本

| 命令 | 说明 | |------|------| | pnpm run build | 清理并构建 CJS + ESM 到 dist/ | | pnpm run test | 运行 Vitest(单次) | | pnpm run test:watch | Vitest 监听模式 | | pnpm run test:ci | CI:测试 + 覆盖率 + JUnit | | pnpm run lint | ESLint 检查 | | pnpm run lint:fix | ESLint 自动修复 |

许可证

MIT