arquivo de download expresso
app.get((req, res, next) => {
res.download('/file/to/be/downloaded.ext');
res.status(200);
});
garzj
app.get((req, res, next) => {
res.download('/file/to/be/downloaded.ext');
res.status(200);
});
/*index.ejs*/
<body>
<a href='download/'><img src='/images/downloadbutton.png'/></a>
</body>
/*indexController.js*/
exports.download = async function(req, res, next)
{
res.download("public/downloads/text.txt";
}
}