Question

I have to upload and download files from blob storage. Found a good article on tutorial to upload and download files. I have some queries though.

  1. I want to create folder structure and do operations like

    a. Fetch a particular file from folder

    b. Fetch all files of a folder and its subfolders

    c. Fetch name of files which are in a particular folder

    d. Fetch name of files which are in a particular folder and its subfolders

  2. Upload files to a particular folder or subfolder

What are the best practices for doing so and should I use queue in all this? What would be performance impact if I am uploading large files to blob?

Was it helpful?

Solution

You can't really use queues for that purpose. Reasons being:

  • Maximum size of a message in a queue is 64 KB. What would happen if your file size is more than 64 KB?
  • More importantly, queues are not meant for that purpose. Queues are typically used as asynchronous communication channel between disconnected applications.

Do search around and you will find plenty of examples about uploading files in blob storage.

For uploading folders, essentially you will iterate over a folder and list all files and upload these files. Since blob storage doesn't really support folder hierarchy, you would need to name the blob by prepending the folder structure to the name of the file. For example, let's say you're uploading files from C:\images\thumbnails folder in a blob container named assets. If you're uploading a file called a.png, you can name the blob as images/thumbnails/a.png and that way you can preserve the folder structure.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top