Skip to content

Path

File path utilities: join, normalize, basename, dirname, extension.

6 modules

ModuleDescription
Path BasenameGet file name from path
Path DirnameGet directory name from path
Path ExtensionGet file extension from path
Path Is AbsoluteCheck if path is absolute
Path JoinJoin path components
Path NormalizeNormalize a file path

Modules

Path Basename

path.basename

Get file name from path

Parameters:

NameTypeRequiredDefaultDescription
pathstringYes-File path
remove_extensionbooleanNoFalseFile path

Output:

FieldTypeDescription
resultstringRemove file extension from result
originalstringFile name
extensionstringFile name

Path Dirname

path.dirname

Get directory name from path

Parameters:

NameTypeRequiredDefaultDescription
pathstringYes-File path

Output:

FieldTypeDescription
resultstringFile path
originalstringDirectory name

Path Extension

path.extension

Get file extension from path

Parameters:

NameTypeRequiredDefaultDescription
pathstringYes-File path
include_dotbooleanNoTrueFile path

Output:

FieldTypeDescription
resultstringInclude the dot in extension
originalstringFile extension
has_extensionbooleanFile extension

Path Is Absolute

path.is_absolute

Check if path is absolute

Parameters:

NameTypeRequiredDefaultDescription
pathstringYes-File path to check

Output:

FieldTypeDescription
resultbooleanFile path to check
pathstringWhether path is absolute
absolutestringWhether path is absolute

Path Join

path.join

Join path components

Parameters:

NameTypeRequiredDefaultDescription
partsarrayYes-Path components to join

Output:

FieldTypeDescription
resultstringPath components to join
partsarrayJoined path

Path Normalize

path.normalize

Normalize a file path

Parameters:

NameTypeRequiredDefaultDescription
pathstringYes-File path to normalize
resolvebooleanNoFalseFile path to normalize

Output:

FieldTypeDescription
resultstringResolve to absolute path
originalstringNormalized path
is_absolutebooleanNormalized path

Released under the Apache 2.0 License.