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

Function createS3Backend

apps/sim/lib/uploads/core/storage-service.ts:208–236  ·  view source on GitHub ↗
(
  key: string,
  config: S3Config,
  contentType: string,
  purpose: string
)

Source from the content-addressed store, hash-verified

206}
207
208async function createS3Backend(
209 key: string,
210 config: S3Config,
211 contentType: string,
212 purpose: string
213): Promise<MultipartBackend> {
214 const {
215 initiateS3MultipartUpload,
216 uploadS3Part,
217 completeS3MultipartUpload,
218 abortS3MultipartUpload,
219 } = await import('@/lib/uploads/providers/s3/client')
220 const { uploadId } = await initiateS3MultipartUpload({
221 fileName: key,
222 contentType,
223 fileSize: 0,
224 customConfig: config,
225 customKey: key,
226 purpose,
227 })
228 const parts: S3MultipartPart[] = []
229 return {
230 async uploadPart(partNumber, body) {
231 parts.push(await uploadS3Part(key, uploadId, partNumber, body, config))
232 },
233 finish: () => completeS3MultipartUpload(key, uploadId, parts, config).then(() => undefined),
234 abort: () => abortS3MultipartUpload(key, uploadId, config),
235 }
236}
237
238async function createBlobBackend(
239 key: string,

Callers 1

ensureBackendFunction · 0.85

Calls 3

abortS3MultipartUploadFunction · 0.85

Tested by

no test coverage detected