{ "source": "doc/api/path.markdown", "modules": [ { "textRaw": "Path", "name": "path", "desc": "
This module contains utilities for handling and transforming file paths. \nAlmost all these methods perform only string transformations. The file system is not consulted to check whether paths are valid.\nSupports both windows and posix. \n\n
\nUse require('path')
to use this module. The following methods are provided:\n\n
Gets the filesystems root path. \n\n
\n", "signatures": [ { "params": [ { "name": "filePath", "optional": true } ] } ] }, { "textRaw": "path.getSep()", "type": "method", "name": "getSep", "desc": "Gets the filesystems default path seperator\n\n
\n", "signatures": [ { "params": [] } ] }, { "textRaw": "path.pathEquals(a, b)", "type": "method", "name": "pathEquals", "desc": "Checks if path a is equal to b\n\n
\n", "signatures": [ { "params": [ { "name": "a" }, { "name": "b" } ] } ] }, { "textRaw": "path.normalize(filepath)", "type": "method", "name": "normalize", "desc": "Normalize a string path, taking care of '..' and '.' parts.\n\n
\nWhen multiple slashes are found, they're replaced by a single one; when the path contains a trailing slash, it is preserved. On Windows backslashes are used.\n\n
\n", "signatures": [ { "params": [ { "name": "filepath" } ] } ] }, { "textRaw": "path.join(...)", "type": "method", "name": "join", "desc": "Joins a splat of different strings together with the default seperator to form a valid path\n\n
\n", "signatures": [ { "params": [ { "name": "..." } ] } ] }, { "textRaw": "path.resolve([from ...], to)", "type": "method", "name": "resolve", "desc": "Works backwards, joining the arguments until it resolves to an absolute path. \nIf an absolute path is not resolved, then the current working directory is prepended\n\n
\nE.g.\n\n
\n> path.resolve('/foo/bar', '/tmp/file/')\n'/tmp/file/'
\n",
"signatures": [
{
"params": [
{
"name": "from ...",
"optional": true
},
{
"name": "to"
}
]
}
]
},
{
"textRaw": "path.relative(from, to)",
"type": "method",
"name": "relative",
"desc": "Returns the relative path from 'from' to 'to' \nIf no relative path can be solved, then 'to' is returned\n\n
\n", "signatures": [ { "params": [ { "name": "from" }, { "name": "to" } ] } ] }, { "textRaw": "path.dirname(filepath)", "type": "method", "name": "dirname", "desc": "Return the directory name of a path. Similar to the Unix dirname command.\n\n
\n", "signatures": [ { "params": [ { "name": "filepath" } ] } ] }, { "textRaw": "path.basename(filepath, expected_ext)", "type": "method", "name": "basename", "desc": "Return the last portion of a path. Similar to the Unix basename command.\n\n
\n", "signatures": [ { "params": [ { "name": "filepath" }, { "name": "expected_ext" } ] } ] }, { "textRaw": "path.extname(filepath)", "type": "method", "name": "extname", "desc": "Return the extension of the path, from the last '.' to end of string in the last portion of the path. If there is no '.' in the last portion of the path or the first character of it is '.', then it returns an empty string. Examples:\n\n
\n", "signatures": [ { "params": [ { "name": "filepath" } ] } ] }, { "textRaw": "path.isAbsolute(filepath)", "type": "method", "name": "isAbsolute", "desc": "Checks if filepath is absolute\n\n
\n", "signatures": [ { "params": [ { "name": "filepath" } ] } ] }, { "textRaw": "path.isUNC(filepath)", "type": "method", "name": "isUNC", "desc": "Checks if the path follows Microsofts universal naming convention\n\n
\n", "signatures": [ { "params": [ { "name": "filepath" } ] } ] }, { "textRaw": "path.isDriveRelative(filepath)", "type": "method", "name": "isDriveRelative", "desc": "Drive-relative paths are unique to Windows and use the format
Returns file path with posix seperators\n
\n", "signatures": [ { "params": [ { "name": "filepath" } ] } ] } ], "type": "module", "displayName": "Path" } ] }