Phantomjs-changeworkingdirectory-method

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

PhantomJS-changeWorkingDirectory

作業ディレクトリを変更でき、成功した場合はtrueを返し、そうでない場合はfalseを返します。

構文

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

fs.changeWorkingDirectory(filepath);

*changeWorkingDirectory* メソッドの例を見てみましょう。
var fs = require('fs');
console.log(fs.workingDirectory);  //prints the location where phantomjs is running
fs.changeWorkingDirectory("C:\\");
console.log(fs.workingDirectory);  //prints C:/

上記のプログラムは、次の output を生成します。

C:/phantomjs/bin
C:/