The audio file downloaded by node cannot be played.

let message = await sequlize.models.chat_message.find({ where: { type: "voice", them: "video", phone: "17660590622" }, raw: true })
   for (let index = 0; index < message.length; indexPP) {
            const element = message[index];

            var file_url = message.message;
            var DOWNLOAD_DIR = "./downloads/";
            download_file_httpget(file_url,index);
         }
         
var download_file_httpget = function (file_url,index) {
    try {


        var DOWNLOAD_DIR = "./downloads/";
        var options = {
            host: url.parse(file_url).host,
            port: 80,
            path: url.parse(file_url).pathname
        };

        var file_name = `${index}.mp3`;
        var file = fs.createWriteStream(DOWNLOAD_DIR + file_name);

        http.get(options, function (res) {
            res.on("data", function (data) {
                file.write(data);
            }).on("end", function () {
                file.end();
                console.log(file_name + " downloaded to " + DOWNLOAD_DIR);
            });
        });
    } catch (error) {
        console.log("err***********", error)
    }
};  

you can"t play audio files by downloading audio files with node"s steam module. Message is an array. If you download a single file, you can play it. Why?

Dec.23,2021

you can first copy the link to the browser to see if it can be played


const element = message[index];

var file_url = message.message;

is it wrong? is it var file_url = element.message?

Menu