Azure - is one 'block blob' seen as one file?

我怕爱的太早我们不能终老 提交于 2021-02-07 20:17:07

问题


Question background:

This may be a simple question but I cant find an answer to it. I've just started using Azure storage (for storing images) and want to know if one 'blob' holds a maximum of one file?

This is my container called fmfcpics:

enter image description here

Within the container I have a block blob named myBlob and within this I have one image:

enter image description here

Through the following code, if I upload another image file to the myBlob block blob then it overwrites the image already in there:

 CloudBlockBlob blockBlob = container.GetBlockBlobReference("myblob");


        using (var fileStream = System.IO.File.OpenRead(@"C:\Users\Me\Pictures\Image1.jpg"))
        {
            blockBlob.UploadFromStream(fileStream);
        }

Is this overwriting correct? Or should I be able to store multiple files at the myBlob?


回答1:


Each blob is a completely separate entity, direct-addressable via uri:

http(s)://storageaccountname.blob.core.windows.net/containername/blobname

If you want to manage multiple entities (such as image jpg's in your case), you would upload each one to a separate blob name (and you're free to store as many as you want within a single container, and you may have as many containers as you want).

Note: These are block blobs. There are also page blobs that have random-access capability, and this is the basis for vhd storage (and in that case, the vhd would have a formatted file system within it, with multiple files).




回答2:


In blob Azure Documentation you understand how blob service works and the concepts about this storage service.

In some minutes you can use the service easily



来源:https://stackoverflow.com/questions/30926623/azure-is-one-block-blob-seen-as-one-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!