I've never used javascript to read a file line by line, and phantomjs is a whole new ballgame for me. i know that there is a read() function in phantom, but I'm not entirely sure how to manipulate the data after storing it to a variable. My pseudocode is something like:
filedata = read('test.txt');
newdata = split(filedata, "\n");
foreach(newdata as nd) {
//do stuff here with the line
}
If anyone could please help me with real code syntax, I'm a bit confused as to whether or not phantomjs will accept typical javascript or what.
Although too late, here is what I have tried and is working:
I'm not JavaScript or PhantomJS expert but the following code works for me: