path-js

It is a simple library for working with paths.

var dpath = new Path('/home/daz//Downloads///');

dpath            //=> Path Object
dpath.toString() //=> '/home/daz/Downloads'

Path.normalize('/home/daz//Downloads///') //=> '/home/daz/Downloads'

dpath.dirname()            //=> Path Object
dpath.dirname().toString() //=> '/home/daz'

dpath.basename()            //=> Path Object
dpath.basename().toString() //=> 'Downloads'

dpath.split() //=> { dirname: '/home/daz', basename: 'Downloads' }

vpath = path.join('video/example.mp4');

vpath            //=> Path Object
vpath.toString() //=> '/home/daz/Downloads/video/example.mp4'

Author (Speransky Danil): Personal Page | LinkedIn | GitHub | StackOverflow