path
Functions
join
join(...parts: string[]): stringJoin path segments using the platform separator, normalizing the result.
Parameters:
| Name | Type | Default |
|---|---|---|
| parts | string[] |
Returns: string
(source)
resolve
resolve(...parts: string[]): stringResolve path segments into an absolute path, relative to the current working directory.
Parameters:
| Name | Type | Default |
|---|---|---|
| parts | string[] |
Returns: string
(source)
basename
basename(p: string, ext: string): stringReturn the last portion of a path. If ext is given and the path ends with it, ext is trimmed off.
@param p - The file path @param ext - Extension to strip from the result
Parameters:
| Name | Type | Default |
|---|---|---|
| p | string | |
| ext | string | "" |
Returns: string
(source)
dirname
dirname(p: string): stringReturn the directory portion of a path.
Parameters:
| Name | Type | Default |
|---|---|---|
| p | string |
Returns: string
(source)
extname
extname(p: string): stringReturn the extension of a path (including the leading dot), or an empty string if there is none.
Parameters:
| Name | Type | Default |
|---|---|---|
| p | string |
Returns: string
(source)
relative
relative(from: string, to: string): stringReturn the relative path from 'from' to 'to'.
@param from - The starting path @param to - The target path
Parameters:
| Name | Type | Default |
|---|---|---|
| from | string | |
| to | string |
Returns: string
(source)
isAbsolute
isAbsolute(p: string): booleanReturn true if the path is absolute.
Parameters:
| Name | Type | Default |
|---|---|---|
| p | string |
Returns: boolean
(source)