- 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 - readLink
This method returns the absolute path of a file or folder pointed by a symlink (or shortcut on Windows). If the path is not a symlink or shortcut, it will return an empty string.
Syntax
Its syntax is as follows −
fs.readLink(path);
Example
The following example shows how the readLink method works.
var fs = require('fs'); var path = 'C:\phantomjs\bin\readlink.txt'; if (fs.isLink(path)) { var absolute = fs.readLink(path); console.log('The absolute path of "'+path+'" is "'+absolute+'"'); } else console.log('"'+path+'" is an absolute path'); phantom.exit();
The above program generates the following output.
readlink.txt
phantomjs_file_system_module_methods.htm
Advertisements
To Continue Learning Please Login
Login with Google