KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
How can I download a file that is in my server to my machine accessing a page in a nodeJS server? I'm using the ExpressJS and I've been trying this: app.get('/download', function(req, res){ var file = fs.readFileSync(__dirname + '/upload-folder/dramaticpenguin.MOV', 'binary'); res.setHeader('Content-Length', file.length); res.write(file, 'binary'); res.end(); }); But I can't get the file name and the file type ( or extension ). Can anyone help me with that?
Tags (comma-separated)
Save Edits
Cancel