Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

235
Views
download and save excell file by http in node js

I have below node js code for download an file from another server but after download, when I want to open file ,get me an error and error message is 'The file format or extension is not valid ...'

http.get('http://members.tsetmc.com/tsev2/excel/MarketWatchPlus.aspx?d=0', (response) => {
    var dataChunk = ''       
    var path='data.xlsx'
        response.on('data', (chunk) => {           
        dataChunk += chunk;
    });
    response.on('end', () => {         
    fs.writeFile(path, dataChunk, undefined, function (err) {
            if (err) {
                console.log(err);
                res.status(500).send(err);
                return
            }
            console.log("The file was saved!");
            res.status(200).send(dataChunk);
        })
    });
}).on("error", (error) => {
    console.log("Error: " + error.message);
});
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!