Created
May 27, 2014 19:55
-
-
Save mickaelandrieu/4c1f7301353ceabc9f83 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Open file.csv and read all lines | |
**/ | |
var fs = require('fs'); | |
var casper = require('casper').create({ | |
verbose: true, | |
logLevel: 'error', | |
pageSettings: { | |
loadImages: false, | |
loadPlugins: false, | |
userAgent: 'Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.2 Safari/537.36' | |
} | |
}); | |
casper.start(); | |
casper.then(function readFile() { | |
stream = fs.open('foo.csv', 'r'); | |
line = stream.readLine(); | |
i = 0; | |
while(line) { | |
casper.echo(line); | |
line = stream.readLine(); | |
i++; | |
} | |
}); | |
casper.run(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment