getParentFolderPath
The getParentFolderPath() function returns the parent folder of a POSIX path.
WARNING
Works only with POSIX paths (not Windows paths).
Interactive example
Syntax
typescript
function getParentFolderPath<
GenericPath extends string
>(
path: GenericPath
): string | null;Parameters
path: The path to analyze.
Return value
The parent folder of the path, or null when no parent is found (including when the path has no /).
See also
getBaseName- Returns the last segment of a pathgetExtensionName- Returns the extension of a path
