PhantomJS - remove
This method is used to remove a specified file.
Syntax
Its syntax is as follows −
var fs = require('fs');
fs.remove(path);
Example
The following example shows how the remove method works.
Command − phantomjs remove.js test.txt
var fs = require('fs');
var system = require('system');
var path = system.args[1];
var md = fs.isFile(path);
console.log("File is present : "+fs.isFile(path));
console.log("Removing file "+path);
var rd = fs.remove(path);
console.log("File is present "+fs.isFile(path));
phantom.exit();
The above program generates the following output.
File is present: true Removing file test.txt File is present false
phantomjs_file_system_module_methods.htm
Advertisements