Search code examples
androidreact-nativebase64fetchexpo

How to get base64 string from a data received from fetch in React Native expo app?


I'm using fetch in React-Native expo app.

fetch(url).then( data=>data.blob()).then( data=>

And here where I got stuck. How to get the Base64 data to use in the data: scheme in the Image component (using URL is not an option) ? It looks like any js base64 converter requires strings, not binary data.

Please advice. Regards


Solution

  • let reader = new FileReader();
    reader.readAsDataURL(blob);