Path Helpers
Table of Contents
path
Visit the: code | unit tests
{absolute}
Get the directory path segment from the given filepath
.
Params
ext
Stringreturns
String
Example
{{absolute "docs/toc.md"}}
{dirname}
Get the directory path segment from the given filepath
.
Params
ext
Stringreturns
String
Example
{{dirname "docs/toc.md"}}
{relative}
Get the relative filepath from a
to b
.
Params
a
Stringb
Stringreturns
String
Example
{{relative a b}}
{basename}
Get the file extension from the given filepath
.
Params
ext
Stringreturns
String
Example
{{basename "docs/toc.md"}}
{stem}
Get the "stem" from the given filepath
.
Params
filepath
Stringreturns
String
Example
{{stem "docs/toc.md"}}
{extname}
Get the file extension from the given filepath
.
Params
filepath
Stringreturns
String
Example
{{extname "docs/toc.md"}}
{resolve}
Resolve an absolute path from the given filepath
.
Params
filepath
Stringreturns
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"}}