How barun-saha/drive-sonar works
Drive Sonar is a Tauri desktop disk-usage explorer. The user chooses a directory in the frontend, starts a scan, and explores the resulting directory tree, usage visualizations, and file-age/extension summaries; they can also open or trash items and export a report. The backend coordinates platform-specific scanning, builds an arena tree, and serves directory payloads to the UI. The graph preserves the README’s major features; some frontend wiring and command details were not excerpted, so those links are marked unverified.
Main entry points: App.tsx App workflow · scan.rs Scan and navigation · VisualizationPanel.tsx Visualization panel · ExtensionChart.tsx Extension chart
Components 21
Desktop interface
- App workflow
src/App.tsx - Scan toolbar
src/components/Toolbar.tsx - Directory browser
src/components/ItemList.tsx - Path navigation
src/components/PathNav.tsx
Scan backend
- Tauri command registry
src-tauri/src/lib.rs - Scan and navigation
src-tauri/src/commands/scan.rs - Parallel scanner
src-tauri/src/scanner.rs - Platform readers
src-tauri/src/scanner - Tree and summaries
src-tauri/src/tree.rs - Scan data models
src-tauri/src/models.rs - Disk information
src-tauri/src/commands/disk.rs
Usage analysis
- Visualization panel
src/components/VisualizationPanel.tsx - Space map
src/components/SizeChart.tsx - Extension chart
src/components/ExtensionChart.tsx - File age chart
src/components/AgeScatterChart.tsx - Chart controls
src/components/ChartHeader.tsx - Log scale hook
src/hooks/useLogScale.ts - Byte formatting
src/utils/format.ts
File actions and reports
- Report export
src/utils/exportReport.ts - Open and trash
src-tauri/src/commands/file_ops.rs
Other components
- Desktop user
Connections 32
- Desktop user → App workflow: uses
README.md - App workflow → Scan toolbar: presents
src/App.tsx - App workflow → Directory browser: presents
src/App.tsx - App workflow → Visualization panel: presents
src/App.tsx - App workflow → Scan and navigation: invokes scan
- App workflow → Scan and navigation: requests navigation
src/App.tsx - App workflow → Disk information: requests disk info
src/App.tsx - App workflow → Scan and navigation: cancels scan
src/App.tsx - App workflow → Report export: exports report
src/App.tsx - Directory browser → Path navigation: renders
src/components/ItemList.tsx - Directory browser → Open and trash: opens or trashes
src/components/ItemList.tsx - Visualization panel → Space map: renders
src/components/VisualizationPanel.tsx - Visualization panel → Extension chart: renders
src/components/VisualizationPanel.tsx - Visualization panel → File age chart: renders
src/components/VisualizationPanel.tsx - File age chart → Chart controls: uses controls
src/components/AgeScatterChart.tsx - Extension chart → Chart controls: uses controls
src/components/ExtensionChart.tsx - File age chart → Log scale hook: uses scale
src/components/AgeScatterChart.tsx - Extension chart → Log scale hook: uses scale
src/components/ExtensionChart.tsx - File age chart → Byte formatting: formats values
src/components/AgeScatterChart.tsx - Extension chart → Byte formatting: formats values
src/components/ExtensionChart.tsx - Report export → Byte formatting: formats values
src/utils/exportReport.ts - Tauri command registry → Scan and navigation: registers commands
src-tauri/src/lib.rs - Tauri command registry → Disk information: registers command
src-tauri/src/lib.rs - Tauri command registry → Open and trash: registers commands
src-tauri/src/lib.rs - Scan and navigation → Parallel scanner: runs scan
src-tauri/src/commands/scan.rs - Parallel scanner → Platform readers: dispatches reads
src-tauri/src/scanner.rs - Scan and navigation → Tree and summaries: builds payload
src-tauri/src/commands/scan.rs - Scan and navigation → Scan data models: uses state and payloads
src-tauri/src/commands/scan.rs - Tree and summaries → Scan data models: builds tree payloads
src-tauri/src/tree.rs - Open and trash → Tree and summaries: checks tree items
src-tauri/src/commands/file_ops.rs - Disk information → Scan data models: returns disk info
src-tauri/src/commands/disk.rs - Open and trash → Scan data models: uses item data
src-tauri/src/commands/file_ops.rs