alexa

How do I send a variable from the server as a downloadable text file with a specific file name in nods.js ?

How do I send a variable from the server as a downloadable text file with a specific file name in nods.js ?

With fs.writeFileSync you do actually create a file on the server. Instead, use

 res.set("Content-Disposition", "attachment; filename=" + filename);
res.end(filedata);

190 0
7

Write a Comments


* Be the first to Make Comment

GoodFirms Badge
GoodFirms Badge

Fix Your Meeting With Our SEO Consultants in India To Grow Your Business Online

Facebook
Twitter
LinkedIn
Instagram
Whatsapp
Call Now
Quick Inquiry