The picture of blob downloaded through responseType = blob uses wirteFileSync to write to the local picture and opens incorrectly.

    async function downImgForSrc(src){
        if(!src)return
        let params = {
            url: src,
            method: "get",
            responseType: "blob"
        }
        try{
            let res = await axios(params)
            let blob = res.data
            fs.writeFileSync("img", blob)
        }catch(e){
            console.log("down img error", e)
        }
    }

No error was reported, but the picture I opened was wrong. Is there something wrong with it? Please take a look at

Dec.23,2021

 request('https://img.codeshelper.com/upload/img/2021/12/23/juvwwvgssp02030.png').pipe(fs.createWriteStream('google.png'))

Pictures have been downloaded in this way

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-1b36c6b-2b889.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-1b36c6b-2b889.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?