path.isAbsolute()

path.isAbsolute(path)

Determines whether path is an absolute path. An absolute path will always resolve to the same location, regardless of the working directory.

Posix examples:

path.isAbsolute('/foo/bar') // true
path.isAbsolute('/baz/..')  // true
path.isAbsolute('qux/')     // false
path.isAbsolute('.')        // false

Windows examples:

path.isAbsolute('//server')  // true
path.isAbsolute('C:/foo/..') // true
path.isAbsolute('bar\\baz')  // false
path.isAbsolute('.')         // false

Note: If the path string passed as parameter is a zero-length string, unlike other path module functions, it will be used as-is and false will be returned.

doc_Nodejs
2016-04-30 04:41:00
Comments
Leave a Comment

Please login to continue.