Skip to content

chengyixu/storage-explorer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Storage Explorer 📊

A real-time interactive disk usage visualization tool that helps you understand how your storage space is being used.

中文文档

Features ✨

  • Real-time Analysis: Scans actual disk usage dynamically
  • Interactive Treemap: Visual representation of storage with proportional block sizes
  • Drill-down Navigation: Click folders to explore their contents
  • Beautiful UI: Modern gradient design with smooth animations
  • Lightweight: Uses only Python standard library, no external dependencies
  • Cross-platform: Works on macOS, Linux, and Windows

Screenshots 🖼️

Storage Explorer Interface

Installation 🚀

Prerequisites

  • Python 3.6 or higher
  • Modern web browser (Chrome, Firefox, Safari, Edge)

Quick Start

  1. Clone the repository:
git clone https://github.com/chengyixu/storage-explorer.git
cd storage-explorer
  1. Run the server:
python3 storage_explorer.py
  1. Open your browser:
    • The server will automatically open http://localhost:8890
    • If not, manually navigate to http://localhost:8890

Usage 📖

Interface Elements

  • Purple Blocks: Folders (clickable to explore)
  • Pink Blocks: Files (non-clickable)
  • Block Size: Proportional to disk usage

Navigation

  • Click Folders: Drill down into subdirectories
  • Back Button: Navigate to parent directory
  • Home Button: Return to home directory
  • Path Display: Shows current directory location

How It Works

  1. The server scans your directory using the du command
  2. Data is sent to the browser as JSON
  3. D3.js creates an interactive treemap visualization
  4. Click events trigger new scans for subdirectories

Technical Details 🔧

Architecture

  • Backend: Python HTTP server with directory scanning
  • Frontend: HTML5 + CSS3 + JavaScript (D3.js)
  • Communication: REST API with JSON responses

API Endpoints

  • GET /: Serves the main HTML interface
  • GET /scan?path=<directory>: Returns JSON data for specified directory

Performance

  • Scans limited to top 30 items per directory
  • Timeout protection for large directories
  • Efficient caching in browser

Customization 🎨

Change Port

Edit line in storage_explorer.py:

server = HTTPServer(('localhost', 8890), StorageServer)

Adjust Scan Limit

Modify the item limit in scan_directory():

items = items[:30]  # Change 30 to desired number

Color Schemes

Edit gradient colors in the HTML style section:

.block.folder {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

Troubleshooting 🔍

Common Issues

  1. Permission Denied: Run with appropriate permissions for directories you want to scan
  2. Port Already in Use: Change the port number in the script
  3. Slow Scanning: Large directories may take time; consider reducing scan depth

Debug Mode

To enable console logging, uncomment print statements in scan_directory():

print(f"Scanning directory: {path}")
print(f"Found {len(items)} items")

Security Notes 🔒

  • Runs locally only (localhost)
  • No data leaves your machine
  • Read-only operations (no file modifications)
  • Respects file system permissions

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 👨‍💻

Acknowledgments 🙏

  • D3.js for the treemap visualization
  • Python community for the standard library
  • All contributors and users

⭐ If you find this tool useful, please consider giving it a star on GitHub!

About

Interactive disk usage visualization tool / 交互式磁盘使用可视化工具

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages