2 var argv = require('optimist')
3 .usage('Count the lines in a file.\nUsage: $0')
8 description : 'Load a file'
12 description : 'Numeric base to use for output',
19 var fs = require('fs');
20 var s = fs.createReadStream(argv.file);
23 s.on('data', function (buf) {
24 lines += buf.toString().match(/\n/g).length;
27 s.on('end', function () {
28 console.log(lines.toString(argv.base));