path

crdtuxp. path

Source:

Methods

(static) addTrailingSeparator(filePath, separatoropt)

Make sure a path ends in a trailing separator (helps identify directory paths)
Source:
Parameters:
Name Type Attributes Description
filePath string a file path
separator string <optional>
the separator to use. If omitted, will try to guess the separator.
Returns:
file path with a terminating separator

(static) baseName(filePath, separatoropt) → {string}

Get the last segment of a path
Source:
Parameters:
Name Type Attributes Description
filePath string a file path
separator string <optional>
the separator to use. If omitted, will try to guess the separator.
Returns:
Type:
string
the last segment of the path

(static) dirName(filePath, optionsopt, separatoropt)

Get the parent directory of a path
Source:
Parameters:
Name Type Attributes Description
filePath string a file path
options object <optional>
options:
{
addTrailingSeparator: true/false, default false,
separator: separatorchar. the separator to use. If omitted, will try to guess the
separator.
}
separator string <optional>
-
Returns:
the parent of the path

(static) fileNameExtension(filePath, separatoropt)

Get the file name extension of a path
Source:
Parameters:
Name Type Attributes Description
filePath string a file path
separator string <optional>
the separator to use. If omitted, will try to guess the separator.
Returns:
the lowercased file name extension, without leading period

(static) relativeTo(rootPath, targetPath, pathSeparatoropt) → {string|undefined}

Calculate the relative path to go from a root path to a target path
Source:
Parameters:
Name Type Attributes Description
rootPath string the base path to relate to
targetPath string the base path to reach from the root path
pathSeparator string <optional>
optional: the separator to use. Defaults to the system separator
Returns:
Type:
string | undefined
relative path