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 🙏

© 2025 – Pkg Stats / Ryan Hefner

code-obfuscator

v1.0.1

Published

A powerful HTML and JavaScript obfuscator tool built with Bun runtime

Downloads

182

Readme

code-obfuscator 🛡️

npm version License: MIT

A powerful HTML and JavaScript obfuscator tool built with Bun runtime. Supports advanced code obfuscation, HTML minification, and external JavaScript file processing.

强大的基于 Bun 运行时的 HTML 和 JavaScript 混淆工具。支持高级代码混淆、HTML 压缩以及外部 JavaScript 文件处理。

✨ Features

English

  • 🚀 High Performance: Built with Bun runtime for lightning-fast processing
  • 🛡️ Advanced Obfuscation: Multiple layers of code protection including control flow flattening, dead code injection, and string array encoding
  • 📄 HTML Support: Process HTML files with inline and external JavaScript
  • 🔧 Flexible Configuration: Extensive obfuscation options for different protection levels
  • 🎯 CLI Tool: Easy-to-use command-line interface
  • 📦 Global Installation: Install globally for system-wide usage

中文

  • 🚀 高性能:基于 Bun 运行时,处理速度极快
  • 🛡️ 高级混淆:多层代码保护,包括控制流扁平化、死代码注入和字符串数组编码
  • 📄 HTML 支持:处理包含内联和外部 JavaScript 的 HTML 文件
  • 🔧 灵活配置:丰富的混淆选项,适用于不同保护级别
  • 🎯 CLI 工具:易用的命令行界面
  • 📦 全局安装:支持全局安装,系统级使用

📦 Installation

Global Installation (Recommended)

npm install -g code-obfuscator

Local Installation

npm install code-obfuscator
# or
bun add code-obfuscator

Development Setup

git clone https://github.com/openapphub/code-obfuscator.git
cd code-obfuscator
bun install

🚀 Usage

Command Line Interface

code-obfuscator --input <input-file> --output <output-file>

# Examples
code-obfuscator --input index.html --output obfuscated.html
code-obfuscator --input script.js --output obfuscated.js
code-obfuscator --input ./src/app.html --output ./dist/app.html

Options

| Option | Short | Description | Required | |--------|-------|-------------|----------| | --input | -i | Input HTML or JS file path | Yes | | --output | -o | Output file path | Yes | | --help | -h | Show help information | No | | --version | | Show version number | No |

使用示例

混淆 HTML 文件

code-obfuscator --input index.html --output dist/index.html

混淆 JavaScript 文件

code-obfuscator --input app.js --output dist/app.js

批量处理

# Process multiple files
for file in *.html; do
  code-obfuscator --input "$file" --output "dist/$file"
done

⚙️ Obfuscation Features

The tool uses JavaScript Obfuscator with the following protection features:

代码混淆特性

  • 压缩 (Compaction): Remove unnecessary whitespace and comments
  • 控制流扁平化 (Control Flow Flattening): Transform code structure
  • 死代码注入 (Dead Code Injection): Add meaningless code to confuse analysis
  • 字符串数组 (String Array): Encode strings in arrays with transformations
  • 标识符重命名 (Identifier Renaming): Use hexadecimal names
  • 数字表达式 (Numbers to Expressions): Convert numbers to expressions
  • 字符串分割 (String Splitting): Split strings into chunks
  • 自我保护 (Self-Defending): Prevent code beautification
  • 控制台禁用 (Console Output Disabled): Remove console statements

HTML 处理特性

  • 内联 JavaScript 混淆: Obfuscate <script> tags without src
  • 外部 JavaScript 处理: Process external JS files referenced in HTML
  • HTML 压缩: Minify HTML structure
  • 路径保持: Maintain relative paths for external resources

📁 File Structure After Processing

your-project/
├── index.html          # Original HTML file
├── js/
│   ├── app.js         # Original JS file
│   └── utils.js       # Original JS file
└── dist/              # Output directory
    ├── index.html     # Obfuscated HTML
    └── js/
        ├── app.js     # Obfuscated JS
        └── utils.js   # Obfuscated JS

🔧 Configuration

The obfuscator uses optimized default settings, but you can modify obfuscator.ts for custom configurations:

const jsObfuscatorOptions = {
  compact: true,
  controlFlowFlattening: true,
  deadCodeInjection: true,
  stringArray: true,
  // ... other options
};

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

👨‍💻 Author

jinxiaoman

🙏 Acknowledgments

  • Bun - The blazing fast JavaScript runtime
  • JavaScript Obfuscator - The core obfuscation library
  • Cheerio - Fast, flexible, and lean implementation of core jQuery designed for the server