1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
const azureStorage = require('azure-storage'); const path = require('path'); const azureStorageConfig = { accountName: "", accountKey: "", blobURL: "", containerName: "" }; const downloadBlob = async (blobName, downloadFilePath) => { return new Promise((resolve, reject) => { const name = path.basename(blobName); const blobService = azureStorage.createBlobService(azureStorageConfig.accountName, azureStorageConfig.accountKey); blobService.getBlobToLocalFile(azureStorageConfig.containerName, blobName, `${downloadFilePath}${name}`, function(error, serverBlob) { if (error) { reject(error); } else { resolve(downloadFilePath); } }); }); }; downloadBlob('images/6350402094004393-11.jpeg','./downloads/'); |
I hope you like this Post, Please feel free to comment below, your suggestion and problems if you face - we are here to solve your problems.
I am Arjun from Hyderabad (India). I have been working as a software engineer from the last 7+ years, and it is my passion to learn new things and implement them as a practice. Aside from work, I like gardening and spending time with pets.
Hi Arjun,
Incase if I want to download a zip file which is present in azure file share. Is it possible?