Skip to content

Instantly share code, notes, and snippets.

@adnasa
Created October 18, 2014 15:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adnasa/94e26f50082454910657 to your computer and use it in GitHub Desktop.
Save adnasa/94e26f50082454910657 to your computer and use it in GitHub Desktop.
get the file-extension
var nodePath = require('path');
/**
* @param string filePath
* @return string filePath[extension]
*/
var getFileExtension = function(filePath) {
var extension = nodePath.extname(filePath||'').split('.');
return extension[extension.length - 1];
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment