(loaded: number, total: number)
| 98 | } |
| 99 | |
| 100 | function getDownloadProgress(loaded: number, total: number): ZipProgress { |
| 101 | if (total > 0) { |
| 102 | const percent = 2 + Math.round((loaded / total) * 38); |
| 103 | const loadedMB = (loaded / (1024 * 1024)).toFixed(1); |
| 104 | const totalMB = (total / (1024 * 1024)).toFixed(1); |
| 105 | return { |
| 106 | percent, |
| 107 | message: `Downloading archive (${loadedMB} / ${totalMB} MB)...`, |
| 108 | bytesLoaded: loaded, |
| 109 | bytesTotal: total, |
| 110 | }; |
| 111 | } |
| 112 | |
| 113 | const loadedMB = (loaded / (1024 * 1024)).toFixed(1); |
| 114 | return { |
| 115 | percent: 20, |
| 116 | message: `Downloading archive (${loadedMB} MB)...`, |
| 117 | bytesLoaded: loaded, |
| 118 | }; |
| 119 | } |
no outgoing calls
no test coverage detected