var path = require('path');
//Create a path object:
var obj = { dir: 'C:\\Users\\Refsnes', base: 'demo_path.js' }
//Format the path object into a path string:
var p = path.format(obj);
console.log(p);
C:\Users\Refsnes\demo_path.js