Skip to content

Instantly share code, notes, and snippets.

@Shekharrajak
Created October 16, 2018 14:23
Show Gist options
  • Select an option

  • Save Shekharrajak/b124cfe09cd6109a913716321d94904c to your computer and use it in GitHub Desktop.

Select an option

Save Shekharrajak/b124cfe09cd6109a913716321d94904c to your computer and use it in GitHub Desktop.
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.");
writeStream.end();
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