What is the difference between storing documents in azure blob as files and storing as base64?

Amruthavarshini M 41 Reputation points
2021-07-19T07:52:01.607+00:00

Hello all,

I want to know the difference between storing documents in blob as file and storing it in base64 format.

Can you please please provide me the link to any refrence documents.

I know that base64 takes less space than actual files. I want to understand it in detail.

Thank you..

Azure Storage Accounts
Azure Storage Accounts
Globally unique resources that provide access to data management services and serve as the parent namespace for the services.
2,721 questions
Azure Blob Storage
Azure Blob Storage
An Azure service that stores unstructured data in the cloud as blobs.
2,449 questions
{count} votes

Accepted answer
  1. SUNOJ KUMAR YELURU 13,946 Reputation points MVP
    2021-07-19T09:34:08.54+00:00

    Hi @Amruthavarshini M

    base64 encoding: A binary-to-text encoding scheme whereby an arbitrary sequence of bytes is converted to a sequence of printable ASCII characters, as described in RFC4648.

    binary large object (BLOB): A discrete packet of data that is stored in a database and is treated as a sequence of uninterpreted bytes.

    BLOBs and Base64 Encoding
    BLOBs are supported and stored in the XM_TYPE_STRING hash data dictionary format. The reason is that BLOBs are treated in the same manner as strings because they have already been encoded by using base64 encoding before storage into a dictionary file.

    BLOBs stored in Spreadsheet Data Model files MUST be encoded by using base64 encoding prior to any other compression and storage. For information about the Spreadsheet Data Model file format, see section 2.1.

    If BLOBs are being stored in an XM_TYPE_STRING hash data dictionary, the flag value 0x100 MUST be set in the DictionaryFlags element in the metadata for the dictionary (see section 2.5.2.22.1).

    Because they are strings (with only 64 character symbols used), BLOBs can also be compressed by using Huffman compression. So if compression is used on the string store, both the strings and the BLOBs will be compressed by using Huffman compression if they fall within all of the Huffman compression constraints.

    For more information about XM_TYPE_STRING hash data dictionary metadata, including the dictionary flags that need to be set, see section 2.5.2.22. For more information about the Huffman compression that is used, see section 2.7.4.
    https://learn.microsoft.com/en-us/openspecs/office_file_formats/ms-xldm/58c62f7a-f995-4c68-9ed1-bb0af2ba330b

    Refer- https://stackoverflow.com/questions/39582878/successfully-saving-base64-image-to-azure-blob-storage-but-blob-image-always-bro/39590768

    If the Answer is helpful, please click Accept Answer and up-vote, this can be beneficial to other community members.

    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. KalyanChanumolu-MSFT 8,316 Reputation points
    2021-07-19T10:01:32.33+00:00

    @Amruthavarshini M Thank you for reaching out.
    Technically speaking, you can store your documents in both formats. It all boils down to your use case.

    Base64 encoded data is usually used for data transfer because you can stream and encode/decode in real time. Hence not a very popular format for data storage.
    When you save your documents/images in a Base64 encoded format, you lose the advantages of serving them from a CDN, caching the files in the browser etc.

    However, if you don't have such a requirement and your image signatures are very small (like gravatars or profile pics), storing them as base64 in a database could be more convenient.

    ----------

    If an answer is helpful, please "Accept answer" or "Up-Vote" which might help other community members reading this thread.
    And if you have further questions or issues, please let us know.

    1 person found this answer helpful.