MCPcopy Create free account
hub / github.com/TeleBoxOrg/TeleBox_Plugins / formatSize

Function formatSize

subinfo/subinfo.ts:89–99  ·  view source on GitHub ↗
(size: number)

Source from the content-addressed store, hash-verified

87 let displaySize = size;
88 while (displaySize >= 1024 && level < UNITS.length - 1) {
89 displaySize /= 1024;
90 level++;
91 }
92 return `${displaySize.toFixed(2)} ${UNITS[level]}`;
93}
94
95// 格式化剩余秒数
96function formatTimeRemaining(seconds: number): string {
97 seconds = Math.max(0, Math.floor(seconds));
98 const days = Math.floor(seconds / 86400);
99 const hours = Math.floor((seconds % 86400) / 3600);
100 const minutes = Math.floor((seconds % 3600) / 60);
101 const secs = Math.floor(seconds % 60);
102 return `${days.toString().padStart(2, '0')}天${hours.toString().padStart(2, '0')}小时${minutes.toString().padStart(2, '0')}分${secs.toString().padStart(2, '0')}秒`;

Callers 4

calculateDailyUsageFunction · 0.85
handleSubinfoMethod · 0.85
handleChaMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected