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

Function getBlockBlobClientFor

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

Source from the content-addressed store, hash-verified

623}
624
625async function getBlockBlobClientFor(key: string, customConfig?: BlobConfig) {
626 const { BlobServiceClient, StorageSharedKeyCredential } = await import('@azure/storage-blob')
627 let blobServiceClient: BlobServiceClientType
628 let containerName: string
629
630 if (customConfig) {
631 if (customConfig.connectionString) {
632 blobServiceClient = BlobServiceClient.fromConnectionString(customConfig.connectionString)
633 } else if (customConfig.accountName && customConfig.accountKey) {
634 const credential = new StorageSharedKeyCredential(
635 customConfig.accountName,
636 customConfig.accountKey
637 )
638 blobServiceClient = new BlobServiceClient(
639 `https://${customConfig.accountName}.blob.core.windows.net`,
640 credential
641 )
642 } else {
643 throw new Error('Invalid custom blob configuration')
644 }
645 containerName = customConfig.containerName
646 } else {
647 blobServiceClient = await getBlobServiceClient()
648 containerName = BLOB_CONFIG.containerName
649 }
650
651 return blobServiceClient.getContainerClient(containerName).getBlockBlobClient(key)
652}
653
654/**
655 * Stage a single block from the server (body in hand), returning its

Callers 2

stageBlobPartFunction · 0.85
commitBlobBlockListFunction · 0.85

Calls 1

getBlobServiceClientFunction · 0.85

Tested by

no test coverage detected