Phantomjs-touch-method

提供:Dev Guides
移動先:案内検索

PhantomJS-タッチ

このメソッドは空のファイルを作成します。

構文

その構文は次のとおりです-

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();

次の output が生成されます。

file is present : true