Path Helpers
Table of Contents
path
Visit the: code | unit tests
{{absolute}}
Get the directory path segment from the given filepath.
Params
ext{String}returns{String}
Example
{{absolute "docs/toc.md"}}
{{dirname}}
Get the directory path segment from the given filepath.
Params
ext{String}returns{String}
Example
{{dirname "docs/toc.md"}}
{{relative}}
Get the relative filepath from a to b.
Params
a{String}b{String}returns{String}
Example
{{relative a b}}
{{basename}}
Get the file extension from the given filepath.
Params
ext{String}returns{String}
Example
{{basename "docs/toc.md"}}
{{stem}}
Get the "stem" from the given filepath.
Params
filepath{String}returns{String}
Example
{{stem "docs/toc.md"}}
{{extname}}
Get the file extension from the given filepath.
Params
filepath{String}returns{String}
Example
{{extname "docs/toc.md"}}
{{resolve}}
Resolve an absolute path from the given filepath.
Params
filepath{String}returns{String}
Example
{{resolve "docs/toc.md"}}
{{segments}}
Get specific (joined) segments of a file path by passing a range of array indices.
Params
filepath{String}: The file path to split into segments.returns{String}: Returns a single, joined file path.
Example
{{segments "a/b/c/d" "2" "3"}}
{{segments "a/b/c/d" "1" "3"}}
{{segments "a/b/c/d" "1" "2"}}