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

@kansnpms/storage-pipe

v2.5.0

Published

Browser storage and cookies monitoring - Real-time tracking of localStorage, sessionStorage, cookies, and IndexedDB

Readme

@kansnpms/storage-pipe

npm version npm downloads CI Code Quality license: MIT

🎉 v2.5.0 Released! - Major API consistency fixes and improved documentation. All browser and Node.js APIs now work as documented. See CHANGELOG.md for details.

⚠️ IMPORTANT: This is a monitoring tool that pipes browser storage changes to your CLI terminal. It does NOT provide storage methods like .set(), .get(), .delete(). If you need a general storage solution, this is not the right package.

Storage Pipe

AI‑Friendly storage monitoring client – track real‑time changes to cookies, localStorage, sessionStorage, and IndexedDB from your web applications directly to your Console Log Pipe CLI. Perfect for AI coding assistants debugging storage‑related issues.

🔍 What This Package Does vs. What It Doesn't Do

What Storage Pipe DOES:

  • Monitors browser storage changes in real-time
  • Pipes storage events to your CLI terminal
  • Tracks localStorage, sessionStorage, cookies, IndexedDB changes
  • Streams storage data via WebSocket to Console Log Pipe CLI
  • Provides monitoring methods: .init(), .start(), .stop(), .getCurrentState()

What Storage Pipe DOES NOT DO:

  • Does NOT provide storage methods like .set(), .get(), .delete(), .clear()
  • Does NOT act as a general storage solution or database
  • Does NOT store or persist data itself
  • Does NOT replace localStorage, sessionStorage, or other storage APIs

💡 If You Need General Storage:

  • Use native browser APIs: localStorage, sessionStorage, indexedDB
  • Try storage libraries like: localforage, dexie, idb
  • This package is specifically for monitoring existing storage, not creating new storage

✨ Highlights

| Feature | Description | | -------------------------------- | ------------------------------------------------------------------------------ | | Real‑time storage monitoring | Track cookies, localStorage, sessionStorage, IndexedDB changes as they happen. | | WebSocket streaming | <10 ms latency from browser storage changes to CLI terminal. | | AI‑optimised JSON format | Storage changes formatted as structured JSON for effortless AI parsing. | | Multi‑storage support | Monitor all browser storage APIs in one unified interface. | | Session isolation | Each browser tab/app gets unique sessionId for organized storage debugging. | | Configurable monitoring | Enable/disable specific storage types and adjust polling intervals. |


🚀 Quick Start

1. Install the CLI

npm install -g @kansnpms/console-log-pipe-cli

2. Start the Storage Monitor Service

# Start storage monitoring on port 3002
clp storage --port 3002

3. Add to Your Web Application

Option A: Browser Script Tag (Easiest)

<script src="https://unpkg.com/@kansnpms/storage-pipe/dist/storage-monitor.umd.js"></script>
<script>
  // Initialize storage monitoring (NOT storage creation)
  StorageMonitor.init({
    serverPort: 3002, // Must match CLI port
  }).then(() => {
    console.log('Storage monitoring active!');
  });
</script>

Option B: NPM Package

npm install @kansnpms/storage-pipe
import { ConsoleLogPipeStorage } from '@kansnpms/storage-pipe';

// Initialize storage monitoring
const storage = await ConsoleLogPipeStorage.init({
  serverPort: 3002, // Must match CLI port
});

Now when your app uses storage, changes appear in CLI:

localStorage.setItem('theme', 'dark'); // ← This will be monitored
sessionStorage.setItem('user', 'john'); // ← This will be monitored
document.cookie = 'session=abc123'; // ← This will be monitored

// The monitor pipes these changes to your CLI terminal in real-time!
// Note: Use native storage APIs for actual storage operations

📋 Features

  • 🍪 Cookie Monitoring: Real-time tracking of cookie changes (add, modify, delete)
  • 💾 localStorage Monitoring: Automatic detection of localStorage changes
  • 🔄 sessionStorage Monitoring: Live updates for sessionStorage modifications
  • 🗃️ IndexedDB Monitoring: Basic IndexedDB operation tracking
  • 📡 Real-time Updates: WebSocket-based instant change notifications
  • 🎯 AI-Friendly: Structured data format perfect for AI development tools
  • 🔧 Configurable: Customizable polling intervals and feature toggles

🛠️ Usage Examples

📋 API Usage by Environment

🌐 Browser Script Tag (Recommended for Quick Setup)

<script src="https://unpkg.com/@kansnpms/storage-pipe/dist/storage-monitor.umd.js"></script>
<script>
  // Initialize storage monitoring with static methods
  StorageMonitor.init({
    serverPort: 3002,
    serverHost: 'localhost',
    enableCookies: true,
    enableLocalStorage: true,
    enableSessionStorage: true,
    enableIndexedDB: false, // Disable IndexedDB monitoring
    pollInterval: 500, // Check for changes every 500ms
  }).then(monitor => {
    console.log('🍪 Storage monitoring started!');

    // Use static methods for control
    console.log('Monitoring active:', StorageMonitor.isMonitoring());
    console.log('Connected:', StorageMonitor.isConnected());
  });

  // Stop monitoring
  // StorageMonitor.stop();
</script>

📦 ES6 Module Import (Node.js/Bundlers)

import { ConsoleLogPipeStorage } from '@kansnpms/storage-pipe';

// Create instance with configuration
const storage = new ConsoleLogPipeStorage({
  serverPort: 3002,
  sessionId: 'my-custom-session',
  enableCookies: true,
  enableLocalStorage: true,
  enableSessionStorage: false,
  pollInterval: 1000,
  autoConnect: false, // Manual connection control
});

// Initialize when ready
await storage.init();

// Get current storage state
const currentState = storage.getCurrentState();
console.log('Current storage:', currentState);

// Stop monitoring
storage.stop();

🔧 Static Factory Methods (ES6 Alternative)

import { ConsoleLogPipeStorage } from '@kansnpms/storage-pipe';

// Quick initialization with static method
const monitor = await ConsoleLogPipeStorage.init({
  serverPort: 3002,
  enableIndexedDB: false,
});

console.log('Storage monitoring active:', monitor.isMonitoring());

🔧 CLI Commands

Start Storage Monitor

# Basic usage
clp storage --port 3002

# With custom options
clp storage --port 3002 \
  --poll-interval 500 \
  --no-cookies \
  --no-indexeddb

# Custom session ID
clp storage --port 3002 --session-id "my-debug-session"

CLI Options

| Option | Description | Default | | --------------------- | --------------------------------- | -------------- | | --port | Storage monitor port | 3002 | | --host | Storage monitor host | localhost | | --session-id | Custom session ID | Auto-generated | | --poll-interval | Polling interval (ms) | 1000 | | --no-cookies | Disable cookie monitoring | false | | --no-localstorage | Disable localStorage monitoring | false | | --no-sessionstorage | Disable sessionStorage monitoring | false | | --no-indexeddb | Disable IndexedDB monitoring | false |

📊 Dashboard

Access the web dashboard at http://localhost:3002 when the storage monitor is running:

  • Real-time Statistics: Active sessions, tracked items
  • Configuration Info: Enabled features, polling settings
  • API Documentation: Available endpoints and WebSocket info
  • Integration Examples: Copy-paste code snippets

🔌 API Reference

✅ Available Methods (Monitoring Only)

import { ConsoleLogPipeStorage } from '@kansnpms/storage-pipe';

// Static methods
await ConsoleLogPipeStorage.init(options); // Initialize and start monitoring
ConsoleLogPipeStorage.create(options); // Create instance without starting

// Instance methods
await monitor.start(); // Start monitoring
monitor.stop(); // Stop monitoring
monitor.getCurrentState(); // Get current storage state (read-only)
monitor.isMonitoring(); // Check if monitoring is active
monitor.isConnected(); // Check WebSocket connection
monitor.getSession(); // Get session information
monitor.checkNow(); // Force immediate storage check

❌ Methods NOT Available (This is NOT a storage library)

// These methods DO NOT exist - use native APIs instead:
monitor.set('key', 'value'); // ❌ Use: localStorage.setItem('key', 'value')
monitor.get('key'); // ❌ Use: localStorage.getItem('key')
monitor.delete('key'); // ❌ Use: localStorage.removeItem('key')
monitor.clear(); // ❌ Use: localStorage.clear()
monitor.setItem('key', 'value'); // ❌ Use: localStorage.setItem('key', 'value')
monitor.getItem('key'); // ❌ Use: localStorage.getItem('key')

Configuration Options

interface StorageMonitorConfig {
  serverHost?: string; // Default: 'localhost'
  serverPort?: number; // Default: 3002
  sessionId?: string; // Default: auto-generated
  enableCookies?: boolean; // Default: true
  enableLocalStorage?: boolean; // Default: true
  enableSessionStorage?: boolean; // Default: true
  enableIndexedDB?: boolean; // Default: true
  pollInterval?: number; // Default: 1000 (ms)
  autoConnect?: boolean; // Default: true
}

🎯 AI Development Integration

Perfect for AI-assisted development workflows:

// Get structured storage data for AI analysis
const storageState = monitor.getCurrentState();

// Example output format (AI-friendly):
{
  cookies: [
    { name: 'user_id', value: '12345', domain: '.example.com', timestamp: '...' }
  ],
  localStorage: [
    { key: 'theme', value: 'dark', timestamp: '...' }
  ],
  sessionStorage: [
    { key: 'temp_data', value: '{"session": "active"}', timestamp: '...' }
  ]
}

🔄 Multi-Application Setup

Monitor multiple applications simultaneously:

# Terminal 1: Main app storage
clp storage --port 3002

# Terminal 2: Admin panel storage
clp storage --port 3003

# Terminal 3: Mobile app storage
clp storage --port 3004
// App 1
await StorageMonitor.init({ serverPort: 3002 });

// App 2
await StorageMonitor.init({ serverPort: 3003 });

// App 3
await StorageMonitor.init({ serverPort: 3004 });

🐛 Troubleshooting

Connection Issues

# Check if storage monitor is running
curl http://localhost:3002/api/storage/state

# Verify WebSocket connection
# Browser DevTools → Network → WS tab

Common Issues

  1. Port already in use: Change port with --port 3003
  2. CORS errors: Storage monitor enables CORS by default
  3. WebSocket connection failed: Check firewall settings
  4. No storage changes detected: Verify polling interval and enabled features

📝 Changelog

v2.3.7

  • Production release
  • Cookie monitoring with real-time change detection
  • localStorage and sessionStorage monitoring
  • Basic IndexedDB support
  • WebSocket-based real-time communication
  • CLI integration with Console Log Pipe
  • Web dashboard for monitoring

🤝 Contributing

This is a production feature of Console Log Pipe. Feedback and contributions welcome!

📄 License

MIT License - see LICENSE file for details.

🔗 Related Packages