Skip to content

getParentFilePath

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

Returns the parent path one level above the given path.

Parameters

NameTypeRequiredDefault
filePathstring
isWindowsnamedboolean
Whether the target operating system to be checked is Windows

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

Returns

string

Examples

javascript
getParentFilePath('C:\\Windows\\System32', true); // 'C:\Windows'
getParentFilePath('/home/user/text.txt'); // '/home/user'
dart
getParentFilePath('C:\\Windows\\System32', isWindows: true); // 'C:\Windows'
getParentFilePath('/home/user/text.txt'); // '/home/user'
python
getParentFilePath('C:\\Windows\\System32', True) # 'C:\Windows'
getParentFilePath('/home/user/text.txt') # '/home/user'

Released under the MIT License