path-dirname
Advanced tools
Node.js path.dirname() ponyfill
Weekly downloads
Readme
Node.js
path.dirname()
ponyfill
This was needed in order to expose path.posix.dirname()
on Node.js v0.10
$ npm install --save path-dirname
const pathDirname = require('path-dirname');
pathDirname('/home/foo');
//=> '/home'
pathDirname('C:\\Users\\foo');
//=> 'C:\\Users'
pathDirname('foo');
//=> '.'
pathDirname('foo/bar');
//=> 'foo'
//Using posix version for consistent output when dealing with glob escape chars
pathDirname.win32('C:\\Users\\foo/\\*bar');
//=> 'C:\\Users\\foo/'
pathDirname.posix('C:\\Users\\foo/\\*bar');
//=> 'C:\\Users\\foo'
See the path.dirname()
docs.
POSIX specific version.
Windows specific version.
MIT
Node.js path.dirname() ponyfill
The npm package path-dirname receives a total of 11,255,821 weekly downloads. As such, path-dirname popularity was classified as popular.
We found that path-dirname demonstrated a not healthy version release cadence and project activity. It has 1 open source maintainer collaborating on the project.