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

Method formatSize

music/music.ts:259–268  ·  view source on GitHub ↗
(bytes: number)

Source from the content-addressed store, hash-verified

257 }
258
259 static formatDuration(seconds: number): string {
260 const mins = Math.floor(seconds / 60);
261 const secs = seconds % 60;
262 return `${mins}:${secs.toString().padStart(2, "0")}`;
263 }
264
265 // 解析多种时长表示:"mm:ss"、"hh:mm:ss"、"225"、"225s"、"3分45秒"
266 static parseDuration(input: string): number | undefined {
267 if (!input) return undefined;
268 const txt = String(input).trim();
269
270 // 纯数字(秒)或带 s 后缀
271 const secNum = /^\d+(?:\.\d+)?s?$/i;

Callers 2

downloadMethod · 0.80
embedMetadataOnlyMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected