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

Function deleteFromBlob

apps/sim/lib/uploads/providers/blob/client.ts:453–483  ·  view source on GitHub ↗
(key: string, customConfig?: BlobConfig)

Source from the content-addressed store, hash-verified

451export async function deleteFromBlob(key: string, customConfig: BlobConfig): Promise<void>
452
453export async function deleteFromBlob(key: string, customConfig?: BlobConfig): Promise<void> {
454 const { BlobServiceClient, StorageSharedKeyCredential } = await import('@azure/storage-blob')
455 let blobServiceClient: BlobServiceClientType
456 let containerName: string
457
458 if (customConfig) {
459 if (customConfig.connectionString) {
460 blobServiceClient = BlobServiceClient.fromConnectionString(customConfig.connectionString)
461 } else if (customConfig.accountName && customConfig.accountKey) {
462 const credential = new StorageSharedKeyCredential(
463 customConfig.accountName,
464 customConfig.accountKey
465 )
466 blobServiceClient = new BlobServiceClient(
467 `https://${customConfig.accountName}.blob.core.windows.net`,
468 credential
469 )
470 } else {
471 throw new Error('Invalid custom blob configuration')
472 }
473 containerName = customConfig.containerName
474 } else {
475 blobServiceClient = await getBlobServiceClient()
476 containerName = BLOB_CONFIG.containerName
477 }
478
479 const containerClient = blobServiceClient.getContainerClient(containerName)
480 const blockBlobClient = containerClient.getBlockBlobClient(key)
481
482 await blockBlobClient.deleteIfExists()
483}
484
485/**
486 * Derive the deterministic Azure block id for a given part number.

Callers 2

client.test.tsFile · 0.90
deleteFileFunction · 0.85

Calls 1

getBlobServiceClientFunction · 0.85

Tested by

no test coverage detected