Search code examples
node.jsazureazure-functionsazure-storageazure-blob-storage

How to delete folder from azure storage using node js


New to Azure storages need to delete folder from container using node js but not able to find any proper solution for node I am able to delete container

blobService.deleteContainerIfExists('test', function(error, result, response){
    if(!error){
      console.log('container deleted!')
    }
});

but not getting any solution for deleting folder inside container.I am working on a NodeJS server. Any help would be appreciated.


Solution

  • In azure blob storage, the folder is virtual and it's part of the blob name. So you cannot directly delete the folder.

    If you want to delete the folder, first you should delete all the blobs in that folder. Then the folder will deleted as well.

    Or you can use Azure Data Lake Storage Gen2, which is similar to azure blob storage, and it does support folder-delete operation.