title: Download a file from NodeJS Server using Express
body: <p>How can I download a file that is in my server to my machine accessing a page in a nodeJS server?</p>
  
  <p>I'm using the ExpressJS and I've been trying this:</p>
  
  <pre><code>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();
  });
  </code></pre>
  
  <p>But I can't get the file name and the file type ( or extension ). Can anyone help me with that?</p>