# path.getBasename

Function · category: Other

Source: https://github.com/playcanvas/engine/blob/b5b983982a9860d21e0c1dafb2f85f72e2c01afb/src/core/path.js#L116

```ts
getBasename(pathname: string): string
```

Return the basename of the path. That is the second element of the pair returned by passing
path into [path.split](https://api.playcanvas.com/engine/functions/path.split.md).

**Parameters**

- `pathname` (`string`): The path to process.

**Returns** `string`: The basename.

**Example**

```ts
path.getBasename("/path/to/file.txt"); // returns "file.txt"
path.getBasename("/path/to/dir"); // returns "dir"
```
