Skip to main content

basename

method path.PlatformPath.basename
Jump to headingPlatformPath.basename(
path: string,
suffix?: string,
): string

Return the last portion of a path. Similar to the Unix basename command. Often used to extract the file name from a fully qualified path.

Parameters Jump to heading

Jump to headingpath: string

the path to evaluate.

optional
Jump to headingsuffix: string

optionally, an extension to remove from the result.

Return Type Jump to heading

string
TypeError

if path is not a string or if ext is given and is not a string.

Back to top