(bytes: number)
| 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; |
no outgoing calls
no test coverage detected