- PhantomJS - Methods
- PhantomJS - Object
- PhantomJS - Environment Setup
- PhantomJS - Overview
- PhantomJS - Home
WebPage Module
- PhantomJS - Child Process Module
- PhantomJS - Events/Callbacks
- PhantomJS - Methods
- PhantomJS - Properties
File System Module
System Module
Web Server Module
Miscellaneous
- PhantomJS - Examples
- PhantomJS - REPL
- PhantomJS - Testing
- PhantomJS - Network Monitoring
- PhantomJS - Page Automation
- PhantomJS - Screen Capture
- Command Line Interface
PhantomJS Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
PhantomJS - File System Module Methods
The following table has all the methods and their descriptions, which are available on the File System module.
S.No | Methods & Description |
---|---|
1 | This method gives the absolute path where PhantomJS runs. |
2 | This allows you to change the working directory and returns true, if it succeeds otherwise returns false. |
3 | copyTree will copy a directory from one path to another. The first parameter is a source folder and the second parameter is a destination folder. |
4 | This method helps to copy file from one location to another. It takes two parameters. The first parameter is the source file and the second parameter is the file path, where it has to be copied. It will throw an error, if the source or destination file does not exist. |
5 | It checks whether the given file path exists in the system. It returns true, if it is present, otherwise false. |
6 | This method will return true, if the file path is absolute and false, if relative. |
7 | isDirectory tells if the given file is a directory or not. It returns true, if directory otherwise false. It gives false in case if the given path does not exist. |
8 | This method will tell if the given file is executable or not. It returns true, if executable, otherwise false. |
9 | This gives details whether the filepath given is a file or not. It returns true, if it is a file and false, if it is not. |
10 | This will give you true, if the file path is a sympnk, otherwise false. |
11 | It checks if the given file is readable or not. It gives true, if yes and false, if not. |
12 | It tells whether if a given file is writable. Returns true, if yes, otherwise false. |
13 | Gives the details of the last modification done to the file. It tells the date and time of when the file was last modified. |
14 | It gives all the files present in the directory. |
15 | Creates a new directory. |
16 | makeTree creates all necessary folders to be able to form final directories. This will return true, if the creation was successful, otherwise false. If the directory already exists, it will return true. |
17 | It will move the file from one path to another. |
18 | It is used to open up the file. |
19 | This will return the absolute path of a file or a folder pointed by a sympnk (or shortcut on Windows). If the path is not a sympnk or shortcut, it will return an empty string. |
20 | This will read the given file. |
21 | This will remove the given directory. |
22 | It will delete all the files and folders from the given folder and finally delete the folder itself. If there is any error while doing this process, it will throw an error – Unable to remove directory tree PATH and hang execution. |
23 | It removes the given file. |
24 | It gives the size of the file. |
25 | It creates a given file. |
26 | Writes to a given file. |