I have a situation in which I need to transmit an object from back-end to front-end in this format:

```
{
    filename: "filename",
    type: "type",
    src: "src",
    bytes: "base64Representation"
}

```

The bytes property of the object consists in the base64 representation of a file stored in a repository in the remote server. Up until now I've worked with small files in the range 1-2MB and the code for converting a file to the corresponding base64 representation has worked correctly. But now I'm facing some problems with big files, larger than 100MB. I've checked solutions that try to convert the file chunk by chunk, but still at the end of the process I need all the chunks concatenated in a string and at this step I'm getting an **OutOfMemory** exception. I've also seen some suggestions to use **OutputStreams**, but I can't apply them because I need the data in the above format. Please does anyone have any suggestions on how can I bypass this situation?