|
|
@ -1,4 +1,4 @@ |
|
|
|
## Path |
|
|
|
# Path |
|
|
|
|
|
|
|
This module contains utilities for handling and transforming file |
|
|
|
paths. Almost all these methods perform only string transformations. |
|
|
@ -9,7 +9,7 @@ logically be found in the fs module as they do access the file system. |
|
|
|
|
|
|
|
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. |
|
|
|
|
|
|
@ -23,7 +23,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. |
|
|
@ -38,7 +38,7 @@ Example: |
|
|
|
// returns |
|
|
|
'foo/bar' |
|
|
|
|
|
|
|
### path.resolve([from ...], to) |
|
|
|
## path.resolve([from ...], to) |
|
|
|
|
|
|
|
Resolves `to` to an absolute path. |
|
|
|
|
|
|
@ -77,7 +77,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`. |
|
|
|
|
|
|
@ -97,7 +97,7 @@ Examples: |
|
|
|
// returns |
|
|
|
'../../impl/bbb' |
|
|
|
|
|
|
|
### path.dirname(p) |
|
|
|
## path.dirname(p) |
|
|
|
|
|
|
|
Return the directory name of a path. Similar to the Unix `dirname` command. |
|
|
|
|
|
|
@ -107,7 +107,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. |
|
|
|
|
|
|
@ -121,7 +121,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 |
|
|
|