Azure Page Blob obligates me to tamper the file size
I'm trying to create a Page Blob, because I would need random access in the future, although I can upload the file, when I download it the size is different.
I get "file.docx" uploaded, and then downloaded as "file2.docx". The downloaded one is a little bigger, actually its size is rounded to page blob page size, 512 :) In this particular case, Microsoft Word gives me a warning saying the file is corrupt, but I can still open it and the content is what I was expecting.
I got the code example from here: Using Windows Azure Page Blobs and How to Efficiently Upload and Download Page Blobs. I've checked out the code to upload it and the documentation, and apparently your page upload must start on a 512 byte boundary (startingOffset % 512 == 0), and end on a 512 boundary - 1. Then what does happen when I need to upload a file that is not aligned to 512?
For example, if I have a file with 550bytes and I upload it and download it I'll get a file with 1024 bytes, right? What should I do? keep the original file size in t开发者_开发知识库he metadata or there is a way to do it right?(or example).
Thanks in advance.
Yes, you should "keep the original file size in the metadata". Or consider using block blobs.
When you ask about Random Access - are you referring to a random access within the file or random access of multiple blobs? Your descriptions imply the latter (lots of file transfers) - i.e. small files randomly accessed, in which case a block blob will do what you need.
Do you have a use case for random seeking within the file? There are scenarios for that, but typically the file is much larger than 512bytes.
精彩评论