Skip to content

getFileName

Requires a Node.js runtime ('qsu/node')

Returns the file name within the path.

Parameters

NameTypeRequiredDefault
filePathstring
File or directory path
withExtensionnamedbooleanfalse
Returns the name with extension.

named parameters are passed as named parameters in Dart and keyword arguments in Python.

Returns

string

Examples

javascript
getFileName('/home/user/test.txt'); // 'test'
getFileName('/home/user/test.txt', true); // 'test.txt'
dart
getFileName('/home/user/test.txt'); // 'test'
getFileName('/home/user/test.txt', withExtension: true); // 'test.txt'
python
getFileName('/home/user/test.txt') # 'test'
getFileName('/home/user/test.txt', True) # 'test.txt'

Released under the MIT License