MCPcopy Index your code
hub / github.com/simstudioai/sim / completeS3MultipartUpload

Function completeS3MultipartUpload

apps/sim/lib/uploads/providers/s3/client.ts:462–489  ·  view source on GitHub ↗
(
  key: string,
  uploadId: string,
  parts: S3MultipartPart[],
  customConfig?: S3Config
)

Source from the content-addressed store, hash-verified

460 * Complete multipart upload for S3
461 */
462export async function completeS3MultipartUpload(
463 key: string,
464 uploadId: string,
465 parts: S3MultipartPart[],
466 customConfig?: S3Config
467): Promise<{ location: string; path: string; key: string }> {
468 const config = customConfig || { bucket: S3_KB_CONFIG.bucket, region: S3_KB_CONFIG.region }
469 const s3Client = getS3Client()
470
471 const command = new CompleteMultipartUploadCommand({
472 Bucket: config.bucket,
473 Key: key,
474 UploadId: uploadId,
475 MultipartUpload: {
476 Parts: parts.sort((a, b) => a.PartNumber - b.PartNumber),
477 },
478 })
479
480 const response = await s3Client.send(command)
481 const location = response.Location || buildObjectFallbackUrl(config.bucket, config.region, key)
482 const path = `/api/files/serve/${encodeURIComponent(key)}`
483
484 return {
485 location,
486 path,
487 key,
488 }
489}
490
491/**
492 * Abort multipart upload for S3

Callers 3

client.test.tsFile · 0.90
createS3BackendFunction · 0.85
completeOneFunction · 0.85

Calls 3

getS3ClientFunction · 0.85
buildObjectFallbackUrlFunction · 0.85
sendMethod · 0.80

Tested by

no test coverage detected