( key: string, config: BlobConfig, contentType: string )
| 236 | } |
| 237 | |
| 238 | async function createBlobBackend( |
| 239 | key: string, |
| 240 | config: BlobConfig, |
| 241 | contentType: string |
| 242 | ): Promise<MultipartBackend> { |
| 243 | const { stageBlobPart, commitBlobBlockList, abortMultipartUpload } = await import( |
| 244 | '@/lib/uploads/providers/blob/client' |
| 245 | ) |
| 246 | const parts: AzureMultipartPart[] = [] |
| 247 | return { |
| 248 | async uploadPart(partNumber, body) { |
| 249 | parts.push(await stageBlobPart(key, partNumber, body, config)) |
| 250 | }, |
| 251 | finish: () => commitBlobBlockList(key, parts, contentType, config), |
| 252 | abort: () => abortMultipartUpload(key, config), |
| 253 | } |
| 254 | } |
| 255 | |
| 256 | /** |
| 257 | * Open a streaming multipart upload to the configured provider. On the local |
no test coverage detected