var fetch = require("node-fetch"); async function query(data) { const response = await fetch( "https://api-inference.huggingface.co/models/openskyml/dalle-3-xl", { headers: { Authorization: "Bearer " }, method: "POST", body: JSON.stringify(data), } ); const result = await response.blob(); return result; } var fs = require("fs-extra"); async function a() { await query({"inputs": "dragon"}).then(async(response) => { //console.log(response.arrayBuffer()) var barray =await response.arrayBuffer(); const buffer = Buffer.from(barray); fs.writeFileSync(__dirname+"/hg.png",buffer) console.log(buffer) // Use image }) } a()