Remove the extension from the string path to file. It's similar to path.basename.
Install the module with: npm install remove-ext
var rmExt = require('remove-ext')
path = '/path/to/gif.gif',
result = rmExt(path, 'gif');
console.log(result); // 'path/to/gif'
Remove extension without knowing which extension it is:
var rmExt = require('remove-ext')
path = '/path/to/image.png',
result = rmExt(path);
console.log(result); // 'path/to/image'
MIT © Fredrik Forsmo