Skip to content

Commit

Permalink
Update uploadimage.js
Browse files Browse the repository at this point in the history
removed changes  from merging issues
  • Loading branch information
abhinovpankaj authored Oct 15, 2023
1 parent bead122 commit 84d2a74
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions database/uploadimage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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',' ');
Expand Down

0 comments on commit 84d2a74

Please sign in to comment.