Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
app.get('/createFile', (req, res) => {
var fs = require("fs");
var writeStream = fs.createWriteStream("./data/dynamic_file.txt");
writeStream.write("Hi, Users. I am generated after the /createFile get request. ");
writeStream.write("Thank You.");
res.send('File is generated. Click <a href="/resources/dynamic_file.txt"> here </a> to see the file. Save/download the file using ctrl+s');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment