(body: Buffer)
| 291 | } |
| 292 | |
| 293 | const dispatchPart = async (body: Buffer): Promise<void> => { |
| 294 | // Bound concurrency: wait for a free slot before starting another part. |
| 295 | while (inflight.size >= MULTIPART_MAX_INFLIGHT) await Promise.race(inflight) |
| 296 | if (firstError) throw firstError |
| 297 | const be = await ensureBackend() |
| 298 | const partNo = ++partNumber |
| 299 | const p = be |
| 300 | .uploadPart(partNo, body) |
| 301 | .catch((err) => { |
| 302 | firstError ??= err |
| 303 | }) |
| 304 | .finally(() => { |
| 305 | inflight.delete(p) |
| 306 | }) |
| 307 | inflight.add(p) |
| 308 | } |
| 309 | |
| 310 | const abort = async (): Promise<void> => { |
| 311 | aborted = true |
no test coverage detected