PhantomJS - isReadable



检查提供的文件是否可读。如果是,则返回 true,否则返回 false

语法

其语法如下 −

var fs = require('fs'); 
fs.isReadable(filename); 

示例

以下示例演示了 isReadable 方法的用法。

命令 - phantomjs isfile.js isfile.js

var fs = require('fs'); 
var system = require('system'); 

console.log(fs.isReadable(system.args[1])); 
phantom.exit();

上述程序会生成以下 输出

True
phantomjs_file_system_module_methods.htm
广告