PhantomJS - isFile



此方法檢查提供的檔案路徑是否為檔案。如果檔案路徑為檔案,則返回true;否則返回false

語法

其語法如下所示 −

var fs = require('fs'); 
fs.isFile(filepath); 

示例

下列示例展示了 isFile 方法的用法。

命令 − phantomjs isfile.js isfile.js

var fs = require('fs'); 
var system = require('system'); 
console.log(fs.isFile(system.args[1])); 
phantom.exit();

以上程式生成以下輸出

True
phantomjs_file_system_module_methods.htm
廣告
© . All rights reserved.