We have a requirement to process attachments to convert blob to base64 format. We are querying the attachment body (i.e. in blob format) and converting that into base64 format in apex class.
Below is the code for reference:
String myBodyContent = myAttachment.body.toString();
EncodingUtil.base64Encode(Blob.valueOf(myBodyContent)); // getting heap size error on this line
We thought of storing small chunks of attachment directly into base64 format rather than converting it entirely in one go. Is there any way to achieve this? Also, is there any way to store attachment contents directly into base64 in any object's field?