Skip to main content

basename()

const basename: (p, ext?) => string = upath.basename

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

ParameterTypeDescription

p

string

the path to evaluate.

ext?

string

optionally, an extension to remove from the result.

Returns

string