diff --git a/database/uploadimage.js b/database/uploadimage.js index 681398b..43e4e77 100644 --- a/database/uploadimage.js +++ b/database/uploadimage.js @@ -12,7 +12,7 @@ const account = process.env.AZURE_STORAGE_ACCOUNT_NAME; //const defaultAzureCredential = new DefaultAzureCredential(); const blobServiceClient = BlobServiceClient.fromConnectionString(process.env.STORAGE_CONNECTION_STRING); -const blobServiceClientOld = BlobServiceClient.fromConnectionString(process.env.OLD_STORAGE_CONNECTION_STRING); + async function uploadFile(containerName, blobName, localFileWithPath, uploadOptions) { try { @@ -38,21 +38,7 @@ async function uploadFile(containerName, blobName, localFileWithPath, uploadOpti } -async function getBlobBufferFromOld(blobName,containerName) { - const containerClient = blobServiceClientOld.getContainerClient(containerName); - blobName= blobName.replace('%20',' '); - const blobClient = containerClient.getBlobClient(blobName); - - // Get blob content from position 0 to the end - // In Node.js, get downloaded data by accessing downloadBlockBlobResponse.readableStreamBody - const downloadBlockBlobResponse = await blobClient.download(); - const downloaded = ( - await streamToBuffer(downloadBlockBlobResponse.readableStreamBody) - ); - - - return downloaded; -} + async function getBlobBuffer(blobName,containerName) { const containerClient = blobServiceClient.getContainerClient(containerName); blobName= blobName.replace('%20',' ');