()
| 105 | let uploadedBytes = 0; |
| 106 | |
| 107 | async function worker(): Promise<void> { |
| 108 | while (true) { |
| 109 | const index = nextIndex; |
| 110 | nextIndex += 1; |
| 111 | if (index >= layout.length) return; |
| 112 | const entry = layout[index]; |
| 113 | if (entry === undefined) return; |
| 114 | const completed = await uploadOnePartWithRetry(filePath, entry, options); |
| 115 | results[index] = completed; |
| 116 | uploadedBytes += entry.part.size; |
| 117 | options.onProgress?.(uploadedBytes, totalBytes); |
| 118 | } |
| 119 | } |
| 120 | |
| 121 | await Promise.all(Array.from({ length: concurrency }, () => worker())); |
| 122 | return results; |
no test coverage detected