title: Node.js get file extension
body: <p>Im creating a file upload function in node.js with express 3.</p>
  
  <p>I would like to grab the file extension of the image. so i can rename the file and then append the file extension to it.</p>
  
  <pre><code>app.post('/upload', function(req, res, next) {
      var is = fs.createReadStream(req.files.upload.path),
          fileExt = '', // I want to get the extension of the image here
          os = fs.createWriteStream('public/images/users/' + req.session.adress + '.' + fileExt);
  });
  </code></pre>
  
  <p>How can i get the extension of the image in node.js?</p>