- PhantomJS Tutorial
- PhantomJS - Home
- PhantomJS - Overview
- PhantomJS - Environment Setup
- PhantomJS - Object
- PhantomJS - Methods
- WebPage Module
- PhantomJS - Properties
- PhantomJS - Methods
- PhantomJS - Events/Callbacks
- PhantomJS - Child Process Module
- File System Module
- PhantomJS - Properties
- PhantomJS - Methods
- System Module
- PhantomJS - Properties
- Web Server Module
- PhantomJS - Properties
- PhantomJS - Methods
- Miscellaneous
- Command Line Interface
- PhantomJS - Screen Capture
- PhantomJS - Page Automation
- PhantomJS - Network Monitoring
- PhantomJS - Testing
- PhantomJS - REPL
- PhantomJS - Examples
- PhantomJS Useful Resources
- PhantomJS - Quick Guide
- PhantomJS - Useful Resources
- PhantomJS - Discussion
PhantomJS - isAbsolute
This method returns true if the filepath is absolute. If the filepath is relative, it returns false.
Syntax
Its syntax is as follows −
var fs = require('fs'); fs.isAbsolute(path);
Example
The following example shows the use of isAbsolute() method.
var fs = require('fs'); var path ='C:\phantomjs\bin\a.txt'; if (fs.isAbsolute(path)) { console.log(' Absolute path.'); } else { console.log('NOT an absolute path.'); } phantom.exit();
The above program generates the following output.
Absolute path.
phantomjs_file_system_module_methods.htm
Advertisements