I\'m trying to learn async programming and was struggling with lesson 4 of nodeschool.io with the implementation of an async io with callbacks.
Basically, I\'m trying to
Same problem for me. This is my solution.
var fs = require('fs'); var file = process.argv[2]; function count(pFile, callback) { fs.readFile(pFile, "utf8", function(err, data){ callback(data.split("\n").length-1); }); } count(file, console.log);