I am working on a api that fetches the image from the server and it is giving the image as blob and now i wanted to convert that blob to a image file and save locally
I had tried to convert the image to base64 and then convert it to image and also tried some stackoverflow fixes but none of them worked
Here is the code
async function query(data) {
var url;
url = "https://api-inference.huggingface.co/models/prompthero/openjourney";
try {
const response = await request(
{
method: 'POST',
uri: url,
headers: {
'Authorization': 'AUTHTOKEN-HERE!!!',
},
body: JSON.stringify(data),
}
);
const result = await response.blob();
console.log(result)
return result;
}
catch (err) {
console.log("error occured");
console.log(err)
}
}