Tutorials References Exercises Videos Menu
Create Website Get Certified Upgrade

Node.js path.isAbsolute() Method

❮ Path Module


Example

Check if different strings are absolute paths:

var path = require('path');

console.log(path.isAbsolute('/test/demo_path.js')); //true
console.log(path.isAbsolute('test/demo_path.js')); //false
console.log(path.isAbsolute('C:\\test\\demo_path.js')); //true
Run example »

Definition and Usage

The path.isAbsolute() method returns true if the specified path is an absolute path, otherwise false.


Syntax

path.isAbsolute(path);

Parameter Values

Parameter Description
path Required. The path to check

Technical Details

Return Value: A Boolean
Node.js Version: 0.11.2

❮ Path Module