I'm using the Egnyte API
I don't understand how the response object works, I tried to convert the data to Blob object and URL.createObjectURL but this doesn't work for me. I don't know if I can display this images to my website.
DOCS Egnyte API: LIST FILE OR FOLDER
This problem also happens to me when I want to download the image, because the api response returns plain encrypted text and I don't know how I can convert it into an object to download it with javascript/html
DOCS Egnyte API: DOWNLOAD FILE
Axios get images from Egnyte API
const getImages = () => {
axios.get(`${API}/${params.id}/images/`, config).then(res => {
setImagesList(res.data.files)
}).catch((error) => {
console.log(error)
})
}
The response looks like this:
Convert item to Blob object and URL.createObjectURL
const displayImg = (list_images) => {
return list_images.map(img => {
const url = URL.createObjectURL(new Blob([img]))
return (
<div className='div_img' key={img.name}>
<img src={url} />
</div>
)
})
}
The URL object looks like this:
But the website looks:
Response from API DOWNLOAD FILE:
I would be very grateful if someone could explain to me how I can convert the API response into an image object to be able to show it and download it (and files to download).
Thank you very much!