doc refactor: path

This commit is contained in:
isaacs 2012-02-27 11:09:34 -08:00
parent 0e752246d3
commit aef61ee367

View File

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