path Module
The path module provides cross-platform filesystem path manipulation, ensuring seamless behavior across Windows (backslashes) and Unix/macOS (forward slashes).
Importing
djazair
use path
API Reference
| Function / Constant | Description | Example |
|---|---|---|
path.sep | System path separator ("\" or "/"). | path.sep |
path.join(...parts) | Joins path segments with platform separator. | path.join("src", "core", "main.dz") |
path.dirname(filePath) | Returns parent directory path. | path.dirname("/a/b/c.txt") # => "/a/b" |
path.basename(filePath, ext?) | Returns file name, optionally stripping extension. | path.basename("/a/b/file.dz", ".dz") # => "file" |
path.extname(filePath) | Returns file extension including dot. | path.extname("archive.tar.gz") # => ".gz" |
path.isAbsolute(filePath) | Returns True if path is absolute. | path.isAbsolute("/var/log") # => True |
path.normalize(filePath) | Resolves . and .. segments. | path.normalize("a/b/../c") # => "a/c" |