Version: v0.8.1 - Beta.  We welcome contributors & feedback.

File.pathParts

$path.pathParts() -> Map

Description

Return a Map of the parts of the path.

Key Description
drive For Windows paths with a drive letter (Ex: C:)
dirs List containing each individual directory in the path
dirName The right-most directory name in the path
fileBase File name without extension
fileName File name with extension
fileExt File extension, without leading dot

dir'users/trex33'.pathParts()

// {
//     drive: ''
//     dirs: [
//         'users'
//         'trex33'
//     ]
//     dirName: 'trex33'
// }

file'/app/uploads/users/trex33/profile.png'.pathParts()

// {
//     drive: ''
//     dirs: [
//         '/'
//         'app'
//         'uploads'
//         'users'
//         'trex33'
//     ]
//     dirName: 'trex33'
//     fileBase: 'profile'
//     fileName: 'profile.png'
//     fileExt: 'png'
// }

See Also