A real-time interactive disk usage visualization tool that helps you understand how your storage space is being used.
- 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
- Python 3.6 or higher
- Modern web browser (Chrome, Firefox, Safari, Edge)
- Clone the repository:
git clone https://github.com/chengyixu/storage-explorer.git
cd storage-explorer- Run the server:
python3 storage_explorer.py- Open your browser:
- The server will automatically open
http://localhost:8890 - If not, manually navigate to
http://localhost:8890
- The server will automatically open
- Purple Blocks: Folders (clickable to explore)
- Pink Blocks: Files (non-clickable)
- Block Size: Proportional to disk usage
- Click Folders: Drill down into subdirectories
- Back Button: Navigate to parent directory
- Home Button: Return to home directory
- Path Display: Shows current directory location
- The server scans your directory using the
ducommand - Data is sent to the browser as JSON
- D3.js creates an interactive treemap visualization
- Click events trigger new scans for subdirectories
- Backend: Python HTTP server with directory scanning
- Frontend: HTML5 + CSS3 + JavaScript (D3.js)
- Communication: REST API with JSON responses
GET /: Serves the main HTML interfaceGET /scan?path=<directory>: Returns JSON data for specified directory
- Scans limited to top 30 items per directory
- Timeout protection for large directories
- Efficient caching in browser
Edit line in storage_explorer.py:
server = HTTPServer(('localhost', 8890), StorageServer)Modify the item limit in scan_directory():
items = items[:30] # Change 30 to desired numberEdit gradient colors in the HTML style section:
.block.folder {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}- Permission Denied: Run with appropriate permissions for directories you want to scan
- Port Already in Use: Change the port number in the script
- Slow Scanning: Large directories may take time; consider reducing scan depth
To enable console logging, uncomment print statements in scan_directory():
print(f"Scanning directory: {path}")
print(f"Found {len(items)} items")- Runs locally only (localhost)
- No data leaves your machine
- Read-only operations (no file modifications)
- Respects file system permissions
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Chengyi Xu - GitHub
- 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!
