format
format()
Formats the provided pathObject as a string path; the path object may carry a complete set, or valid subset of, the suite of properties defined on a NodePath object; these include:
dir
: The directory portion of the path.root
: The root directory of the path.base
: The base name of the path.name
: The file name of the path.ext
: The file extension of the path.
Rendering precedence
The base
property takes precedence over the name
and ext
properties, if both are specified; the root
property is prepended to the rendered path.
File extensions
In conformance with Node's behavior, file extensions are expected to carry their initial .
character. No normalization or transformation of the properties occurs.
Accepted types
In conformance with Node's behavior, the pathObject
may be any object that carries the properties described above, or it may be an instance of a parsed path, such as a NodePath object (or its derivatives), as produced by the parse method.
Return
The formatted path.
Parameters
The path object to format.