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

Function uploadS3Part

apps/sim/lib/uploads/providers/s3/client.ts:380–401  ·  view source on GitHub ↗
(
  key: string,
  uploadId: string,
  partNumber: number,
  body: Buffer,
  customConfig?: S3Config
)

Source from the content-addressed store, hash-verified

378 * is for browser uploads; this is the server-side streaming path.
379 */
380export async function uploadS3Part(
381 key: string,
382 uploadId: string,
383 partNumber: number,
384 body: Buffer,
385 customConfig?: S3Config
386): Promise<S3MultipartPart> {
387 const config = customConfig || { bucket: S3_CONFIG.bucket, region: S3_CONFIG.region }
388 const response = await getS3Client().send(
389 new UploadPartCommand({
390 Bucket: config.bucket,
391 Key: key,
392 PartNumber: partNumber,
393 UploadId: uploadId,
394 Body: body,
395 })
396 )
397 if (!response.ETag) {
398 throw new Error(`S3 UploadPart returned no ETag for part ${partNumber} of ${key}`)
399 }
400 return { PartNumber: partNumber, ETag: response.ETag }
401}
402
403/**
404 * Generate presigned URLs for uploading parts to S3

Callers 1

uploadPartFunction · 0.85

Calls 2

getS3ClientFunction · 0.85
sendMethod · 0.80

Tested by

no test coverage detected