Skip to content
On this page

@bridge/path

Functions

basename

basename(p, ext?): string

Return the last portion of a path.

Parameters

NameTypeDescription
pstringThe path to evaluate.
ext?stringOptionally, an extension to remove from the result.

Returns

string


dirname

dirname(p): string

Return the directory name of a path.

Parameters

NameTypeDescription
pstringThe path to evaluate.

Returns

string


extname

extname(p): string

Return the extension of the path, from the last '.' to end of string in the last portion of the path. If there is no '.' in the last portion of the path or the first character of it is '.', then it returns an empty string.

Parameters

NameTypeDescription
pstringThe path to evaluate

Returns

string


join

join(...paths): string

Join all arguments together and normalize the resulting path.

Parameters

NameTypeDescription
...pathsstring[]Paths to join.

Returns

string


relative

relative(from, to): string

Solve the relative path from {from} to {to}. At times we have two absolute paths, and we need to derive the relative path from one to the other.

Parameters

NameType
fromstring
tostring

Returns

string

Released under the GPL-3.0 License.