Node.js path.join() Method
Join several segments into one path:
var x = path.join('Users', 'Refsnes', 'demo_path.js');
Definition and Usage
The path.join() method joins the specified path segments into one path.
You can specify as many path segments as you like.
The specified path segments must be strings, separated by comma.
|paths||Required. Series of path segments to join into one path|
|Return Value:||A String, representing the joined path|
Add a '..' as one of the segments, and the join method will resolve it:
var x = path.join('Users', 'Refsnes', '..', 'demo_path.js');