Continuing the discussion from portal.getMultipartText() returns null:
Enonic version: 6.6.2-SNAPSHOT
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.
btoa work for your usecase?
Nope, ASFAIK. atob, btoa lives in the window object in the browser and only works with text, not binary data…
Btw this is currently a BLOCKER for us.
I guess I’ll have to start looking for Java code for this… dunno whether that will lead to success.
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.
@ComLock can you check this XP lib and see if it solves your problem?
Yes that worked beautifully thanks
I think I made base64 encoding in the lib-util but it probably didn’t get merged yet.