Skip to content

Commit cea60c4

Browse files
author
CNMengHan
committed
First Release version
0 parents  commit cea60c4

File tree

10 files changed

+1900
-0
lines changed

10 files changed

+1900
-0
lines changed

Hide.exe

5.14 MB
Binary file not shown.

README.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# WebUI.DiskdataAnalysis
2+
3+
A modern web-based disk space analyzer with real-time visualization and detailed statistics.
4+
5+
## Features
6+
7+
- 📊 Real-time disk usage visualization
8+
- 📁 Detailed file and directory statistics
9+
- 📈 File type analysis and distribution
10+
- ⚡ Fast concurrent scanning
11+
- 🎯 Top files and directories identification
12+
- 📅 File age distribution analysis
13+
- 🌐 Modern web interface with dark theme
14+
15+
## Installation
16+
17+
### Prerequisites
18+
19+
- Go 1.22
20+
- Modern web browser
21+
22+
## Usage
23+
24+
1. Run the application:
25+
```bash
26+
main.exe
27+
```
28+
29+
2. Open your web browser and navigate to:
30+
```
31+
http://localhost:8080
32+
```
33+
34+
## Features in Detail
35+
36+
- **Disk Usage Analysis**
37+
- Total disk space usage
38+
- Space usage by directory
39+
- File type distribution
40+
41+
- **File Statistics**
42+
- Largest files
43+
- Recently modified files
44+
- File type breakdown
45+
- Directory depth analysis
46+
47+
- **Real-time Updates**
48+
- Progress indication
49+
- Live scanning status
50+
- Dynamic data visualization
51+
52+
## Technical Details
53+
54+
- Backend: Go with concurrent scanning
55+
- Frontend: HTML5, CSS3, JavaScript
56+
- Charts: Chart.js
57+
- File System: Native Go filesystem APIs
58+
- Embedded Resources: Go 1.16+ embed package
59+
60+
## Performance
61+
62+
- Efficient concurrent scanning
63+
- Minimal memory footprint
64+
- Responsive UI updates
65+
- Optimized for large filesystems
66+
67+
## Contributing
68+
69+
Contributions are welcome! Please feel free to submit a Pull Request.
70+
71+
## License
72+
73+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

go.mod

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
module diskstats
2+
3+
go 1.22
4+
5+
require golang.org/x/sys v0.20.0
6+
7+
require (
8+
github.com/go-ole/go-ole v1.2.6 // indirect
9+
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect
10+
github.com/shirou/gopsutil/v3 v3.24.5 // indirect
11+
github.com/yusufpapurcu/wmi v1.2.4 // indirect
12+
)

go.sum

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY=
2+
github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
3+
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c h1:ncq/mPwQF4JjgDlrVEn3C11VoGHZN7m8qihwgMEtzYw=
4+
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE=
5+
github.com/shirou/gopsutil/v3 v3.24.5 h1:i0t8kL+kQTvpAYToeuiVk3TgDeKOFioZO3Ztz/iZ9pI=
6+
github.com/shirou/gopsutil/v3 v3.24.5/go.mod h1:bsoOS1aStSs9ErQ1WWfxllSeS1K5D+U30r2NfcubMVk=
7+
github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0=
8+
github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
9+
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
10+
golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
11+
golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU=
12+
golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
13+
golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y=
14+
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=

index.html

Lines changed: 244 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,244 @@
1+
<!DOCTYPE html>
2+
<html lang="zh">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>磁盘数据统计</title>
7+
<link rel="stylesheet" href="style.css">
8+
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
9+
</head>
10+
<body>
11+
<div class="cursor"></div>
12+
<div class="container">
13+
<header>
14+
<h1>磁盘数据统计</h1>
15+
<button id="scanBtn">开始扫描</button>
16+
</header>
17+
18+
<div class="loading-overlay" id="loadingOverlay">
19+
<div class="loader"></div>
20+
<p>正在扫描磁盘数据...</p>
21+
</div>
22+
23+
<div class="dashboard">
24+
<div class="quick-stats">
25+
<div class="quick-stat-item">
26+
<h3>扫描状态</h3>
27+
<p id="scanStatus">未开始</p>
28+
</div>
29+
<div class="quick-stat-item">
30+
<h3>系统信息</h3>
31+
<p id="systemInfo">-</p>
32+
</div>
33+
</div>
34+
35+
<div class="chart-grid">
36+
<div class="chart-container">
37+
<canvas id="diskUsageChart"></canvas>
38+
</div>
39+
<div class="chart-container">
40+
<canvas id="fileAgeChart"></canvas>
41+
</div>
42+
</div>
43+
44+
<div class="stats-grid">
45+
<div class="stat-card">
46+
<h3>总文件数</h3>
47+
<p id="totalFiles">-</p>
48+
</div>
49+
<div class="stat-card">
50+
<h3>总大小</h3>
51+
<p id="totalSize">-</p>
52+
</div>
53+
<div class="stat-card">
54+
<h3>最大目录深度</h3>
55+
<p id="maxDepth">-</p>
56+
</div>
57+
<div class="stat-card">
58+
<h3>平均文件大小</h3>
59+
<p id="avgFileSize">-</p>
60+
</div>
61+
</div>
62+
63+
<div class="stats-summary">
64+
<div class="summary-card">
65+
<h3>磁盘使用情况</h3>
66+
<div class="summary-header">
67+
<p>总容量: <span id="totalCapacity">-</span></p>
68+
<p>总可用: <span id="totalAvailable">-</span></p>
69+
</div>
70+
<div id="diskSummary" class="summary-content">
71+
<table>
72+
<thead>
73+
<tr>
74+
<th>磁盘</th>
75+
<th>总空间</th>
76+
<th>已用</th>
77+
<th>可用</th>
78+
<th>使用率</th>
79+
</tr>
80+
</thead>
81+
<tbody></tbody>
82+
</table>
83+
</div>
84+
</div>
85+
</div>
86+
87+
<div class="data-section">
88+
<h2>文件类型分析</h2>
89+
<div class="file-type-grid">
90+
<div class="file-type-card">
91+
<h4>文档文件</h4>
92+
<p class="type-count" id="docCount">-</p>
93+
<p class="type-size" id="docSize">-</p>
94+
</div>
95+
<div class="file-type-card">
96+
<h4>多媒体文件</h4>
97+
<p class="type-count" id="mediaCount">-</p>
98+
<p class="type-size" id="mediaSize">-</p>
99+
</div>
100+
<div class="file-type-card">
101+
<h4>压缩文件</h4>
102+
<p class="type-count" id="archiveCount">-</p>
103+
<p class="type-size" id="archiveSize">-</p>
104+
</div>
105+
<div class="file-type-card">
106+
<h4>可执行文件</h4>
107+
<p class="type-count" id="execCount">-</p>
108+
<p class="type-size" id="execSize">-</p>
109+
</div>
110+
</div>
111+
</div>
112+
113+
<div class="data-section">
114+
<h2>最大文件 (前30个)</h2>
115+
<div class="section-summary">
116+
<p>这些文件占用了 <span id="topFilesSizePercentage">-</span> 的总存储空间</p>
117+
</div>
118+
<div class="data-table-container">
119+
<table id="topFilesTable">
120+
<thead>
121+
<tr>
122+
<th>文件路径</th>
123+
<th>大小</th>
124+
<th>类型</th>
125+
<th>占用比例</th>
126+
</tr>
127+
</thead>
128+
<tbody></tbody>
129+
</table>
130+
</div>
131+
</div>
132+
133+
<div class="data-section">
134+
<h2>最近修改的文件</h2>
135+
<div class="section-summary">
136+
<p>最后修改时间范围: <span id="modTimeRange">-</span></p>
137+
</div>
138+
<div class="data-table-container">
139+
<table id="recentFilesTable">
140+
<thead>
141+
<tr>
142+
<th>文件路径</th>
143+
<th>修改时间</th>
144+
<th>大小</th>
145+
<th>距今</th>
146+
</tr>
147+
</thead>
148+
<tbody></tbody>
149+
</table>
150+
</div>
151+
</div>
152+
153+
<div class="chart-container">
154+
<canvas id="fileTypesChart"></canvas>
155+
<div class="chart-legend">
156+
<div id="fileTypeLegend" class="legend-content"></div>
157+
</div>
158+
</div>
159+
160+
<div class="data-section">
161+
<h2>最大目录 (前30个)</h2>
162+
<div class="section-summary">
163+
<p>这些目录包含了 <span id="topDirsFilePercentage">-</span> 的文件</p>
164+
</div>
165+
<div class="data-table-container">
166+
<table id="topDirsTable">
167+
<thead>
168+
<tr>
169+
<th>目录路径</th>
170+
<th>文件数</th>
171+
<th>总大小</th>
172+
<th>深度</th>
173+
<th>占用比例</th>
174+
</tr>
175+
</thead>
176+
<tbody></tbody>
177+
</table>
178+
</div>
179+
</div>
180+
181+
<div class="data-section">
182+
<h2>扫描统计</h2>
183+
<div class="scan-stats">
184+
<div class="scan-stat-item">
185+
<h4>开始时间</h4>
186+
<p id="scanStartTime">-</p>
187+
</div>
188+
<div class="scan-stat-item">
189+
<h4>结束时间</h4>
190+
<p id="scanEndTime">-</p>
191+
</div>
192+
<div class="scan-stat-item">
193+
<h4>耗时</h4>
194+
<p id="scanDuration">-</p>
195+
</div>
196+
</div>
197+
</div>
198+
199+
<div class="data-section">
200+
<h2>文件年龄分布</h2>
201+
<div class="age-distribution">
202+
<div class="age-bar">
203+
<span class="age-label">24小时内</span>
204+
<div class="bar-container">
205+
<div class="bar" id="age1" style="width: 0%"></div>
206+
<span class="bar-value" id="age1Value">-</span>
207+
</div>
208+
</div>
209+
<div class="age-bar">
210+
<span class="age-label">7天内</span>
211+
<div class="bar-container">
212+
<div class="bar" id="age7" style="width: 0%"></div>
213+
<span class="bar-value" id="age7Value">-</span>
214+
</div>
215+
</div>
216+
<div class="age-bar">
217+
<span class="age-label">30天内</span>
218+
<div class="bar-container">
219+
<div class="bar" id="age30" style="width: 0%"></div>
220+
<span class="bar-value" id="age30Value">-</span>
221+
</div>
222+
</div>
223+
<div class="age-bar">
224+
<span class="age-label">更早</span>
225+
<div class="bar-container">
226+
<div class="bar" id="ageOlder" style="width: 0%"></div>
227+
<span class="bar-value" id="ageOlderValue">-</span>
228+
</div>
229+
</div>
230+
</div>
231+
</div>
232+
</div>
233+
</div>
234+
<footer class="author-info">
235+
<a href="https://github.com/CNMengHan" target="_blank" class="github-link">
236+
<svg class="github-icon" viewBox="0 0 16 16">
237+
<path fill="currentColor" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"/>
238+
</svg>
239+
@CNMengHan
240+
</a>
241+
</footer>
242+
<script src="script.js"></script>
243+
</body>
244+
</html>

main.exe

7.52 MB
Binary file not shown.

0 commit comments

Comments
 (0)