JavaScript Lists all Blobs inside Azure Container with directory-level support using web front-end

I'm currently working on developing some set of codes to display all blobs inside specified Azure Container using web front-end. I'm expecting the final output to be something like this:

Directory listing with Apache Mod_autoindex

I started by creating a dummy storage account and populates it with some dummy files for me to play around with.

https://alicebob.blob.core.windows.net/documents  
├── docx  
│   ├── 201801_Discussion.docx  
│   ├── 201802_Discussion.docx  
├── xlsx  
│   ├── 201801_Summary.xlsx  
│   ├── 201802_Summary.xlsx  
│   ├── 201803_Summary.xlsx  
├── 201801_Review.pdf  
├── 201802_Review.pdf  
├── 201803_Review.pdf  

To develop file listing function, I'm using Azure Storage JavaScript client library from here and put all the necessary codes (.html and .js files) in Azure Static website $web container and set index.html as Index document name and Error document path in the Static website configuration.

https://alicebob.z23.web.core.windows.net/  
├── azure-storage.blob.min.js  
├── azure-storage.common.min.js  
├── index.html  

The problem is that the function to do the listing is only either listBlobsSegmentedWithPrefix or listBlobDirectoriesSegmentedWithPrefix. So, in my case, I assume it wouldn't work straightforwardly to list all the blobs and directories in a well-structured / tree format.

My current approach is that I trick the code to keep using listBlobDirectoriesSegmentedWithPrefix until there is no more directory to list inside, then continue to list using listBlobsSegmentedWithPrefix

So far I'm quite satisfied that my code can list all the Blobs at the leaf-level and also list all the directories if it isn't on the leaf-level. You can take a look at the blob listing here and feel free to go for 'View Source' to see the codes I built so far.

The only problem that I face is that this set of code fails to list the Blobs if it wasn't on the leaf-level. For example, it fails to list these blobs on alicebob storage account:

├── 201801_Review.pdf  
├── 201802_Review.pdf  
├── 201803_Review.pdf  

This is an expected issue as I'm not running listBlobsSegmentedWithPrefix if it isn't on the leaf-level. The reason is that it will produces the output with something like this which isn't what I want:

├── docx/201801_Discussion.docx  
├── docx/201802_Discussion.docx  
├── xlsx/201801_Summary.xlsx  
├── xlsx/201802_Summary.xlsx  
├── xlsx/201803_Summary.xlsx  
├── 201801_Review.pdf  
├── 201802_Review.pdf  
├── 201803_Review.pdf 

Any suggestion on how to overcome this issue? The real implementation would involves a huge amount of data so I think a simple if-then-else wouldn't be efficient on this case.

sorry for the long description but I just want to describe my problem as clear as possible :)

Answer:1

I want to block my UI and show a spinner while it is blocked. I tried to use the following : blockUI.start("<div class='dots-loader'>Minions are Working!</div>"); // some code ...

I want to block my UI and show a spinner while it is blocked. I tried to use the following : blockUI.start("<div class='dots-loader'>Minions are Working!</div>"); // some code ...

I'm using mocha and trying to build a testing system which reports tests individually. The goal is to have traceability between tests defined in the requirements for the project and unit tests. So, ...

I'm using mocha and trying to build a testing system which reports tests individually. The goal is to have traceability between tests defined in the requirements for the project and unit tests. So, ...

  1. adding unit test to existing project c#
  2. adding unit test to existing project
  3. adding unit test to legacy code
  4. adding unit test python
  5. adding unit test in java
  6. adding unit test to c#
  7. adding unit test project
  8. qt adding unit test

I have the following jquery selector which I am trying to convert to regular javascript. $("#lelement>*").on("dblclick", function(){ }); what would the equivalent be with regular javascript ? Can ...

I have the following jquery selector which I am trying to convert to regular javascript. $("#lelement>*").on("dblclick", function(){ }); what would the equivalent be with regular javascript ? Can ...

  1. javascript equivalent jquery document ready
  2. javascript equivalent jquery find
  3. javascript equivalent jquery
  4. javascript equivalent of jquery closest
  5. javascript equivalent of jquery load
  6. javascript equivalent of jquery ready
  7. javascript equivalent of jquery append
  8. javascript equivalent of jquery trigger
  9. javascript equivalent of jquery each
  10. javascript equivalent of jquery show
  11. javascript equivalent of jquery text
  12. javascript equivalent of jquery html
  13. javascript equivalent of jquery offset
  14. javascript equivalent of jquery empty
  15. javascript equivalent of jquery animate
  16. javascript equivalent of jquery hide
  17. javascript equivalent of jquery data
  18. javascript equivalent of jquery selector
  19. javascript equivalent of jquery parents
  20. javascript equivalent of jquery click

I have 5 boxes and an array of items. How do I display 5 items in 5 boxes, randomly selected without repetition? Is it a problem with: ptags[index].textContent = item[0].label; that it is not ...

I have 5 boxes and an array of items. How do I display 5 items in 5 boxes, randomly selected without repetition? Is it a problem with: ptags[index].textContent = item[0].label; that it is not ...