In some cases file data might be represented by base64 encoded strings. The following can be used to convert from base64 encoded file data strings to blob:
// Convert base64 string to blob
cropQualityPicture.image = Blob:fromString(cropQualityPicture.imageStr);
Convert blob to base64 encoded string
Similarly to the above, blobs can also be converted to base64 encoded strings:
// Convert blob to base64 string
cropQualityPicture.imageStr = Blob:toString(cropQualityPicture.image);
Convert base64 encoded string to a wrapped blob
Since blob fields on objects are automatically accompanied by meta attributes that describe mime type, file size and file name, an additional conversion is available where a base64 encoded string can be converted to a built-in object that wraps the blob and includes the above mentioned meta fields:
0 Comments