I'm attempting to write a script which is able to take a screenshot given an url using phantom.js. This works great when I supply the url(s). However, I would like to be able to read urls from a file in much the same way as in: here and here. However, all methods return with
unable to open file 'filename.txt'
Am I missing something here? Working from a win7 installation.
EDIT:
var fs = require('fs');
var file_h = fs.open('urls.txt', 'r');
var line = file_h.readLine();
while(line) {
console.log(line);
line = file_h.readLine();
}
file_h.close();
The output I get is:
unable to open file 'urls.txt'
phantomjs://platform/fs.js:79 in open