I am trying to show an image gotten from a server in a React Native app. What I am getting in the response look like this:
I tried to build a Buffer object using buffer and then parse to base64
const imageBuffer = Buffer.from(JSON.stringify(res.data)) // This res.data is the whole object, including the type "Buffer" and the data array
const imageBase64 = imageBuffer.toString('base64')
setImage(imageBase64)
This returns a base64 image but it doesn't show using the React Native Image component
<Image source={{ uri: `data:image/jpeg;base64,${image}` }} />
I didn't found how to handle images with this structure (a buffer as a numbers array) on React Native. I was thinking that maybe it is a way to do this without the library mentioned or without parse the buffer to a base64 but I don't know.
Thank you