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

Function deleteFile

apps/sim/lib/uploads/core/storage-service.ts:435–460  ·  view source on GitHub ↗
(options: DeleteFileOptions)

Source from the content-addressed store, hash-verified

433 * Delete a file from the configured storage provider
434 */
435export async function deleteFile(options: DeleteFileOptions): Promise<void> {
436 const { key, context } = options
437
438 if (context) {
439 const config = getStorageConfig(context)
440
441 if (USE_BLOB_STORAGE) {
442 const { deleteFromBlob } = await import('@/lib/uploads/providers/blob/client')
443 return deleteFromBlob(key, createBlobConfig(config))
444 }
445
446 if (USE_S3_STORAGE) {
447 const { deleteFromS3 } = await import('@/lib/uploads/providers/s3/client')
448 return deleteFromS3(key, createS3Config(config))
449 }
450 }
451
452 const { unlink } = await import('fs/promises')
453 const { join } = await import('path')
454 const { UPLOAD_DIR_SERVER } = await import('./setup.server')
455
456 const safeKey = sanitizeFileKey(key)
457 const filePath = join(UPLOAD_DIR_SERVER, safeKey)
458
459 await unlink(filePath)
460}
461
462/** AWS SDK v3 silently caps HTTP connections at 50/endpoint — stay well under. */
463const PER_FILE_DELETE_CONCURRENCY = 25

Callers 13

runTableImportFunction · 0.90
deletePreviousVersionFunction · 0.90
getOrCreateTableSnapshotFunction · 0.90
runTableExportFunction · 0.90
addDocumentFunction · 0.90
updateDocumentFunction · 0.90
cleanupOrphanFunction · 0.90
deleteCopilotFileFunction · 0.90
route.tsFile · 0.90
completeOneFunction · 0.90
route.tsFile · 0.90

Calls 6

getStorageConfigFunction · 0.90
sanitizeFileKeyFunction · 0.90
deleteFromBlobFunction · 0.85
createBlobConfigFunction · 0.85
deleteFromS3Function · 0.85
createS3ConfigFunction · 0.85

Tested by

no test coverage detected