|
|
@ -1,4 +1,4 @@ |
|
|
|
## Path |
|
|
|
# Path |
|
|
|
|
|
|
|
This module contains utilities for handling and transforming file |
|
|
|
paths. Almost all these methods perform only string transformations. |
|
|
@ -6,7 +6,7 @@ The file system is not consulted to check whether paths are valid. |
|
|
|
|
|
|
|
Use `require('path')` to use this module. The following methods are provided: |
|
|
|
|
|
|
|
### path.normalize(p) |
|
|
|
## path.normalize(p) |
|
|
|
|
|
|
|
Normalize a string path, taking care of `'..'` and `'.'` parts. |
|
|
|
|
|
|
@ -20,7 +20,7 @@ Example: |
|
|
|
// returns |
|
|
|
'/foo/bar/baz/asdf' |
|
|
|
|
|
|
|
### path.join([path1], [path2], [...]) |
|
|
|
## path.join([path1], [path2], [...]) |
|
|
|
|
|
|
|
Join all arguments together and normalize the resulting path. |
|
|
|
Non-string arguments are ignored. |
|
|
@ -35,7 +35,7 @@ Example: |
|
|
|
// returns |
|
|
|
'foo/bar' |
|
|
|
|
|
|
|
### path.resolve([from ...], to) |
|
|
|
## path.resolve([from ...], to) |
|
|
|
|
|
|
|
Resolves `to` to an absolute path. |
|
|
|
|
|
|
@ -74,7 +74,7 @@ Examples: |
|
|
|
// if currently in /home/myself/node, it returns |
|
|
|
'/home/myself/node/wwwroot/static_files/gif/image.gif' |
|
|
|
|
|
|
|
### path.relative(from, to) |
|
|
|
## path.relative(from, to) |
|
|
|
|
|
|
|
Solve the relative path from `from` to `to`. |
|
|
|
|
|
|
@ -94,7 +94,7 @@ Examples: |
|
|
|
// returns |
|
|
|
'../../impl/bbb' |
|
|
|
|
|
|
|
### path.dirname(p) |
|
|
|
## path.dirname(p) |
|
|
|
|
|
|
|
Return the directory name of a path. Similar to the Unix `dirname` command. |
|
|
|
|
|
|
@ -104,7 +104,7 @@ Example: |
|
|
|
// returns |
|
|
|
'/foo/bar/baz/asdf' |
|
|
|
|
|
|
|
### path.basename(p, [ext]) |
|
|
|
## path.basename(p, [ext]) |
|
|
|
|
|
|
|
Return the last portion of a path. Similar to the Unix `basename` command. |
|
|
|
|
|
|
@ -118,7 +118,7 @@ Example: |
|
|
|
// returns |
|
|
|
'quux' |
|
|
|
|
|
|
|
### path.extname(p) |
|
|
|
## path.extname(p) |
|
|
|
|
|
|
|
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 |
|
|
|