Btoa or Buffer function isnt working on IOS


I want to have a dynamic function to generate SVG and convert it to base64. btoa or Buffer functions aint working for ios app. I have read the other forum which states the reason , why on ios is it not working (react-native vs browser functions). But I would like to know what could be the alternative to this? how can I convert svg/strings to base64.

thanks in advance!