path.resolve([from ...], to)
path.resolve('/foo/bar', './baz')
// returns
'/foo/bar/baz'
由于该方法属于path模块,使用前需要引入path模块(var path= require(“path”) )
接收参数:
from 源路径
to 将被解析到绝对路径的字符串
例子:
代码如下:
path.resolve('/foo/bar', './baz')
// returns
'/foo/bar/baz'