Phantomjs-touch-method

提供:Dev Guides
2020年6月23日 (火) 08:11時点におけるMaintenance script (トーク | 投稿記録)による版 (Imported from text file)
(差分) ← 古い版 | 最新版 (差分) | 新しい版 → (差分)
移動先:案内検索

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