PhantomJS - touch 方法
此方法创建一个空文件。
语法
其语法如下 −
var fs = require('fs'); fs.touch(path);
示例
以下示例显示了 touch 方法的工作原理。
命令 − phantomjs touch.js hello.txt
var fs = require('fs'); var system = require('system'); var path = system.args[1]; var md = fs.touch(path); console.log("file is present : "+fs.isFile(path)); phantom.exit();
它将生成以下输出。
file is present : true
phantomjs_file_system_module_methods.html