Azure Page Blob obliges me to resize a file

I am trying to create blob pages because I need random access in the future, although I can upload a file when I upload it, the size is different.

I upload the file "file.docx" and then upload as "file2.docx". The loaded one is slightly larger, in fact its size is rounded to the page size of the blob page, 512 :) In this particular case, Microsoft Word gives me a warning that the file is damaged, but I can still open it, and the content is what i expected.

I got a sample code here: Using Blazs Blogs for Windows Azure and How to Load and Download Blobs Pages Effectively . I checked the code to download it and the documentation, and, apparently, loading your page should start at a border of 512 bytes (startOffset% 512 == 0) and end at a border of 512 - 1. Then what happens when I need to download a file, which does not match 512?

For example, if I have a file with 550 bytes, and I upload it and upload, I get a file with 1024 bytes, right? What should I do? save original file size in metadata or is there a way to do it right? (or an example).

Thanks in advance.

+4
source share
2 answers

Yes, you should "keep the original file size in the metadata." Or consider using block blocks.

+3
source

When you ask about random access - do you refer to random access to a file or random access to multiple blocks? Your descriptions mean the latter (many files), i.e. Small files are randomly available, in which case the block block will do what you need.

Do you have a precedent for randomly searching a file? There are scripts for this, but usually a file is much larger than 512 bytes.

0
source

All Articles