Tutorials References Exercises Videos Menu
Create Website Get Certified Upgrade

Node.js path.format() Method

❮ Path Module


Example

Format a path object into a string and return the result:

var path = require('path');
var obj = { dir: 'C:\\Users\\Refsnes', base: 'demo_path.js' }

var p = path.format(obj);
console.log(p);
Run example »

Definition and Usage

The path.format() method formats a path object into a path string.


Syntax

path.format(pathObject);

Parameter Values

Parameter Description
pathObject Required. The path object to format

Technical Details

Return Value: The path, as a String
Node.js Version: 0.11.15

❮ Path Module