Skip to content

path

Contains utility functions for handling paths.

InterfaceDescription
MakeFileNameParamsParameters for makeFileName.
FunctionDescription
getFileNameGets the file name from the import(dot)meta(dot)url, converting it to a POSIX-style path.
getFolderNameGets the folder name from the import(dot)meta(dot)url, converting it to a POSIX-style path.
isAbsoluteDetermines if a path is absolute.
makeFileNameMakes a file name by appending an extension to a given file name. If the extension is empty, the file name is returned as is.
normalizeIfRelativeNormalizes a given path by ensuring it is relative, adding ”./” if necessary.
resolveResolves a sequence of paths or path segments into an absolute path.
toPosixBufferConverts a buffer containing a path to a POSIX-style buffer by replacing backslashes with forward slashes.
toPosixPathConverts a given path to a POSIX-style path by replacing backslashes with forward slashes.
VariableDescription
basenameReturns the base name of a file, optionally removing the file extension.
delimiterA POSIX path delimiter.
dirnameReturns the directory name of a path. directory is used instead of folder to preserve compatibility with node:path module.
extnameReturns the file extension of a path.
formatFormats a path object into a path string.
joinJoins multiple path segments into a single path.
normalizePathNormalizes a path, resolving ’..’ and ’.’ segments.
parseParses a path string into a path object.
posixProvides methods for handling POSIX paths.
relativeReturns the relative path from one path to another.
sepA POSIX segment separator.