'convert azure directory/subdirectory to zipped blob

I have posted similar question before but not finding anyone's participation or solution from anyone.My requirement is to download folders which azure blob storage does not support.But what if we can get the blobs to local storage and then is it possible to download folder?I have this basic idea but I have no idea how I can achieve that. It would be of great help if someone can let me know ,

  1. How to read data from blob storage ?
  2. How to write that blob in "downloads" path?

I have a basic idea on azure blob service but totally new to filestorage , kindly bear with me.

Thanks in advance.

code:

fileUploadPath = "D:/downloads";
blobService.listBlobsSegmentedWithPrefix(containerName, path, null, (err, data) => {
    if (err) {
        reject(err);
    } else {
        data.entries.forEach(entry => {
            const content = 'Some content!'
            var sourceFilePath = fileUploadPath + '/' + entry.name;
            if (fs.existsSync(fileUploadPath)) {
                var sourceFilePath = fileUploadPath + '/' + entry.name;
                if (!fs.existsSync(sourceFilePath)) {
                    fs.mkdir(sourceFilePath, { recursive: true }, (err) => {
                        if (err) {
                            console.log("Failed :" + err);
                        }
                        else {
                            try {
                                const fstream = 
                                fs.createWriteStream(sourceFilePath);
                                fstream.write('fileContent');
                                fstream.end();
                                fstream.on("finish", f => {
                                    console.log('finish',f) ;                
                                });
                                fstream.on("error", e => {
                                    console.log('error',e);
                                });
                  
        ...


Solution 1:[1]

One of the workarounds is that you can use archiver to zip the required folder.

const archive = archiver('zip', {
  zlib: { level: 9 } // Sets the compression level.
});

For more information on this you can refer to this similar thread.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 SwethaKandikonda-MT