Get the basename of a filepath excluding extension.
Because I've typed the following one too many times:
function filename(fp) {
return path.basename(fp, path.extname(fp));
}
Install with npm
$ npm i file-name --save
var filename = require('file-name');
filename('a/b/c/foo.json');
//=> 'foo'
Other useful node.js path utils:
true if the path appears to be relative. | homepagepath.parse method if… more | homepageInstall dev dependencies:
$ npm i -d && npm test
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Jon Schlinkert
Copyright © 2015 Jon Schlinkert Released under the MIT license.
This file was generated by verb-cli on October 20, 2015.