nodejs中path模块的用法
2017-04-01 本文已影响0人
一半苍白
Added in: v0.1.16
...paths <String> A sequence of path segments
The path.join() method joins all given path segments together using the platform specific separator as a delimiter, then normalizes the resulting path.
Zero-length path segments are ignored. If the joined path string is a zero-length string then'.'will be returned, representing the current working directory.
For example:
path.join('/foo','bar','baz/asdf','quux','..')
// Returns: '/foo/bar/baz/asdf'
path.join('foo',{},'bar')
// throws TypeError: Arguments to path.join must be strings
A TypeError is thrown if any of the path segments is not a string.
![](https://img.haomeiwen.com/i5336896/2eb1d0271f53e3c2.png)