Skip to content

Path

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

6 modules

ModuleDescription
Nama Dasar PathDapatkan nama file dari path
Nama Direktori PathDapatkan nama direktori dari path
Ekstensi PathDapatkan ekstensi file dari path
Path AbsolutPeriksa apakah path absolut
Gabung PathGabungkan komponen path
Normalisasi PathNormalisasi path file

Modules

Nama Dasar Path

path.basename

Dapatkan nama file dari path

Parameters:

NameTypeRequiredDefaultDescription
pathstringYes-Path file
remove_extensionbooleanNoFalsePath file

Output:

FieldTypeDescription
resultstringHapus ekstensi file dari hasil
originalstringNama file
extensionstringNama file

Nama Direktori Path

path.dirname

Dapatkan nama direktori dari path

Parameters:

NameTypeRequiredDefaultDescription
pathstringYes-Path file

Output:

FieldTypeDescription
resultstringPath file
originalstringNama direktori

Ekstensi Path

path.extension

Dapatkan ekstensi file dari path

Parameters:

NameTypeRequiredDefaultDescription
pathstringYes-Path file
include_dotbooleanNoTruePath file

Output:

FieldTypeDescription
resultstringSertakan titik dalam ekstensi
originalstringEkstensi file
has_extensionbooleanEkstensi file

Path Absolut

path.is_absolute

Periksa apakah path absolut

Parameters:

NameTypeRequiredDefaultDescription
pathstringYes-Path file untuk diperiksa

Output:

FieldTypeDescription
resultbooleanPath file untuk diperiksa
pathstringApakah path absolut
absolutestringApakah path absolut

Gabung Path

path.join

Gabungkan komponen path

Parameters:

NameTypeRequiredDefaultDescription
partsarrayYes-Komponen path untuk digabungkan

Output:

FieldTypeDescription
resultstringKomponen path untuk digabungkan
partsarrayPath yang digabungkan

Normalisasi Path

path.normalize

Normalisasi path file

Parameters:

NameTypeRequiredDefaultDescription
pathstringYes-Path file untuk dinormalisasi
resolvebooleanNoFalsePath file untuk dinormalisasi

Output:

FieldTypeDescription
resultstringUbah menjadi path absolut
originalstringPath yang dinormalisasi
is_absolutebooleanPath yang dinormalisasi

Released under the Apache 2.0 License.