Skip to content

Instantly share code, notes, and snippets.

@AlexanderArmua
Created April 4, 2016 21:36
Show Gist options
  • Save AlexanderArmua/0e1b9a270173ddbbcc1752fb2f17a599 to your computer and use it in GitHub Desktop.
Save AlexanderArmua/0e1b9a270173ddbbcc1752fb2f17a599 to your computer and use it in GitHub Desktop.
Descargar un txt desde html con node
exports = module.exports = function(app, conf) { //BASE DEL BACKEND
app.get('/api/orm-txt/download', function(req, res){ // <a href="/api/orm-txt/download" target="_blank">Descargar</a>
var text="Hello World!";
res.set({"Content-Disposition":"attachment; filename=\"test.txt\""}); //Se lo crea como un archivo y se le asigna un nombre
res.send(text); //Se envia al usuario
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment