I would like Enonic to provide a library function, which returns a base64 “pure” js string.
Perhaps a generic io.streamToBase64(stream)
And perhaps a convenience portal.getMultipartAsBase64(name, index) which is simply io.streamToBase64(portal.getMultipartStream(name, index)) behind the scenes.
I started making a simple lib for converting between stream and base64. Hope to be done soon and put it in github.
This will be a separate lib outside of XP.