Skip to content

Instantly share code, notes, and snippets.

@mickaelandrieu
Created May 27, 2014 19:55
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mickaelandrieu/4c1f7301353ceabc9f83 to your computer and use it in GitHub Desktop.
Save mickaelandrieu/4c1f7301353ceabc9f83 to your computer and use it in GitHub Desktop.
/**
* 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