(stage, bytesRead, totalBytes, messagesProcessed, message)
| 27 | * 创建进度对象 |
| 28 | */ |
| 29 | export const createProgress: CreateProgress = (stage, bytesRead, totalBytes, messagesProcessed, message) => { |
| 30 | const percentage = totalBytes > 0 ? Math.min(99, Math.round((bytesRead / totalBytes) * 100)) : 0 |
| 31 | return { |
| 32 | stage, |
| 33 | bytesRead, |
| 34 | totalBytes, |
| 35 | messagesProcessed, |
| 36 | percentage: stage === 'done' ? 100 : percentage, |
| 37 | message, |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | /** |
| 42 | * 解析 ISO 时间戳或毫秒时间戳 |
no outgoing calls
no test coverage detected