MCPcopy
hub / github.com/simstudioai/sim / downloadFromS3Stream

Function downloadFromS3Stream

apps/sim/lib/uploads/providers/s3/client.ts:226–237  ·  view source on GitHub ↗
(
  key: string,
  customConfig?: S3Config
)

Source from the content-addressed store, hash-verified

224 * never resident in memory.
225 */
226export async function downloadFromS3Stream(
227 key: string,
228 customConfig?: S3Config
229): Promise<Readable> {
230 const config = customConfig || { bucket: S3_CONFIG.bucket, region: S3_CONFIG.region }
231 const command = new GetObjectCommand({ Bucket: config.bucket, Key: key })
232 const response = await getS3Client().send(command)
233 if (!response.Body) {
234 throw new Error(`S3 object has no body: ${key}`)
235 }
236 return response.Body as Readable
237}
238
239/**
240 * Check whether an object exists in S3 (and return its size when it does).

Callers 1

downloadFileStreamFunction · 0.85

Calls 2

getS3ClientFunction · 0.85
sendMethod · 0.80

Tested by

no test coverage detected