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

privacy-brush

v1.1.1

Published

Automatically mask sensitive information in terminal outputs and logs. Keep your data safe when sharing.

Downloads

691

Readme

npm version License: MIT tsgo

✨ Features

  • 🎯 Smart Detection - Auto-detects 20+ sensitive information patterns
  • 🔧 Highly Configurable - Custom masking rules and characters
  • High Performance - Stream processing for large files
  • 🛡️ Privacy First - Local processing only, no data leaves your machine
  • 📦 Multiple Formats - CLI, API, Stream, File processing
  • 🌐 Multi-language - Supports English, Chinese, and other log formats
  • 🎨 Customizable - Add your own sensitive patterns

🚀 Quick Start

Basic Usage

# Direct terminal output processing
flutter devices | pnpx privacy-brush
flutter doctor | pnpx privacy-brush

# Process files
privacy-brush -i input.log -o masked.log

# Real-time command output
echo 'Microsoft Windows [Version 10.0.12345.6785]' | privacy-brush

In Your Node.js Project

// Or ES Module
import { PrivacyBrush } from 'privacy-brush';

// Create instance
const brush = new PrivacyBrush();

// Process text
const sensitiveText = `Windows [Version 10.0.12345.1234]
Chrome 144.0.1234.12
User IP: 192.123.1.123`;

const safeText = brush.maskText(sensitiveText);
console.log(safeText);

// Output:
// Windows [Version 10.█.█████.████]
// Chrome 144.█.████.██
// User IP: 192.███.█.███

📖 Examples

Example 1: Process Flutter Output

Original:

❯ flutter devices
Found 4 connected devices:
  Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.12345.1234]
  Chrome (web) • chrome • web-javascript • Google Chrome 144.0.1234.60

After PrivacyBrush:

❯ flutter devices | privacy-brush
Found 4 connected devices:
  Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.█.█████.████]
  Chrome (web) • chrome • web-javascript • Google Chrome 144.█.████.██

Example 2: Process Node.js Debug Logs

const masker = new PrivacyBrush({
  maskChar: '*',
  preserveFirstPart: false
});

const debugLog = `
DEBUG: User login from IP 192.168.1.100
DEBUG: Session ID: abc123def456
DEBUG: Browser: Chrome/144.0.1234.60
DEBUG: OS: Windows 10.0.12345
`;

console.log(masker.mask(debugLog));
// Output:
// DEBUG: User login from IP ***.***.*.***
// DEBUG: Session ID: ************
// DEBUG: Browser: Chrome/***.*.***.**
// DEBUG: OS: Windows **.*.*****

⚙️ Configuration

CLI Options

# Basic usage
privacy-brush [options]

# Options
--char, -c <char>        Mask character (default: █)
--preserve-first         Keep first part of version numbers
--input, -i <file>       File to read from
--output, -o <file>      Output to file
--strict                 Strict mode (mask more info)
--config <file>          Use config file
--list-patterns          List all built-in patterns
--add-pattern <regex>    Add custom regex pattern
--version                Show version
--help                   Show help

Read from stdin by default.

JavaScript API Options

const masker = new PrivacyBrush({
  // Basic config
  maskChar: '█',           // Mask character
  preserveFirstPart: true, // Keep first part of versions
  
  // Pattern config
  patterns: {
    ipAddress: true,
    macAddress: true,
    email: true,
    phone: true,
    creditCard: true,
    jwtToken: true,
    apiKey: true,
    
    osVersion: true,
    browserVersion: true,
    appVersion: true,
    
    deviceId: true,
    serialNumber: true,
    
    filePaths: false,     // Don't mask file paths
    localhost: false      // Don't mask localhost
  },
  
  // Custom patterns
  customPatterns: [
    {
      name: 'custom-id',
      regex: /ID-\d{6}/g,
      mask: 'ID-******'
    }
  ]
});

🔧 Built-in Patterns

PrivacyBrush includes 20+ pre-configured sensitive information patterns:

🔐 Personal Information

  • Email addresses [email protected]***@example.com
  • Phone numbers 13800138000138****8000
  • ID numbers 110101199001011234110101********1234

💻 Technical Information

  • IP addresses 192.168.1.100192.168.*.*
  • MAC addresses 00:1A:2B:3C:4D:5E00:**:**:**:**:**
  • Port numbers :8080:****
  • API keys sk_live_1234567890sk_live_********

🖥️ System & Browser

  • Windows versions 10.0.12345.123410.███.███.███
  • Chrome versions 144.0.1234.60144.███.███.███
  • Android versions Android 16Android ██

🏢 Business Data

  • Credit cards 4111 1111 1111 11114111 **** **** 1111
  • JWT tokens eyJhbGciOiJIUzI1...eyJ********...
  • Session IDs session-abc123def456session-************

🛠️ Advanced Usage

Stream Processing for Large Files

import { createReadStream, createWriteStream } from "node:fs"
import { pipeline } from "node:stream/promises"

import { PrivacyBrush } from "privacy-brush"

const brush = new PrivacyBrush()

const inputStream = createReadStream("./test/fixtures/huge.log")
const maskStream = await brush.createMaskStream()

const dist = `./test/fixtures/masked-huge-${Date.now()}.generated.log`

// biome-ignore format: one stream per line
await pipeline(
  inputStream,
  maskStream,
  createWriteStream(dist)
)

console.log("✅ Large file processing completed!", dist)

Git Hook Integration

#!/bin/bash
# .git/hooks/pre-commit

for file in $(git diff --cached --name-only | grep -E '\.(log|txt|json)$'); do
  if privacy-brush --check "$file"; then
    echo "❌ File $file contains unmasked sensitive information"
    echo "Use: privacy-brush $file -o $file && git add $file"
    exit 1
  fi
done

📁 Configuration File

Create privacy-brush.config.json:

{
  "maskChar": "█",
  "preserveFirstPart": true,
  "patterns": {
    "ipAddress": true,
    "email": true,
    "phone": true,
    "osVersion": true,
    "browserVersion": true
  },
  "customPatterns": [
    {
      "name": "project-api-key",
      "regex": "PROJECT_API_KEY=\\w{32}",
      "mask": "PROJECT_API_KEY=******************************"
    }
  ]
}

🤝 Contributing

We welcome contributions! See CONTRIBUTING.md for details.

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

📄 License

MIT License © 2024 PrivacyBrush Contributors

📞 Support


Terminal Output Masking Tool | Safely Share Logs by Hiding Sensitive Information

Development

# mask stdin with custom patterns
echo 'DEEPSEEK_API_KEY=sk-af75149812524eb08eb302bf9604c8e8' | node src/cli.mjs --pattern '/sk-[a-z0-9]{20,}/'

echo '/c/Users/legend80s/AppData/ /Users/test/code/' | node src/cli.mjs --pattern '/Users/[a-z]{2,}/i'
# /c/Users/█████████/AppData/  /Users/████/code/