In azure-blob-storage javascript sdk, how can I get the total byte size of blobs inside a folder?

katsukichi 21 Reputation points
2022-05-03T10:48:11.863+00:00

Azure Storage Explorer allows you to publish folder statistics.

198533-image.png

What we want to achieve is to calculate the total capacity in bytes of all the blobs in the folder (not actually the structure of the folder).

You can accumulate the size by repeating the list with listBlobFlat, but
In this way, in the case of many blobs, it is expected that the load will be severe.

It asks if there is an api or sdk function to get the capacity of the folder through prefix. I am requesting this because I think that the function in the storage explorer is not likely to be handled as a simple iteration, and the function is attached internally.

198504-image.png

Azure Blob Storage
Azure Blob Storage
An Azure service that stores unstructured data in the cloud as blobs.
2,425 questions
0 comments No comments
{count} votes

Accepted answer
  1. Sumarigo-MSFT 43,411 Reputation points Microsoft Employee
    2022-05-06T05:00:00.427+00:00

    @katsukichi Firstly, apologies for the delay in responding here! Welcome to Microsoft Q&A Forum, Thank you for posting your query here,

    I would look at blob inventory, that will generate a CSV that you can parse to calculate what you are looking for:
    Enable Azure Storage blob inventory reports | Microsoft Learn

    azure-blob-storage javascript sdk, how can I get the total byte size of blobs inside a folder? "Presently this feature isn't available"

    I would post your feature request to http://aka.ms/azurefeedback , All the feedback you share in these forums
    will be monitored and reviewed by the Microsoft engineering teams responsible for building Azure.

    Note: You can also use Log Analytics in such scenarios, but it comes with high cost for such accounts.
    https://learn.microsoft.com/en-us/azure/azure-monitor/logs/log-analytics-tutorial

    Please let us know if you have any further queries. I’m happy to assist you further.

    ----------

    Please do not forget to 199396-screenshot-2021-12-10-121802.png and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.

    0 comments No comments

0 additional answers

Sort by: Most helpful