Nodejs calls the interface that returns binary, how to read json data?

for example, this API of WeChat Mini Programs: https://developers.weixin.qq....

returns binary data. If successful, the binary content is a picture. If it fails, the binary content is json text

now it is time to use fs.createWriteStream to download the content to a file and then read this file to determine whether it has failed. Can you get the binary content directly instead of downloading the binary content to the file?

const writeStream = fs.createWriteStream("./a")
request({
    method: "post",
    url: `https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=${accessToken}`,
    body: JSON.stringify({})
}).pipe(writeStream)
writeStream.on("finish", function () {
    // 
})

Jul.05,2022

response has content-type

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1ea53bc-1d42.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1ea53bc-1d42.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?