Phantomjs-changeworkingdirectory-method
提供:Dev Guides
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:/