Skip to content

Instantly share code, notes, and snippets.

@AlJohri
Created February 15, 2017 00:59
Show Gist options
  • Select an option

  • Save AlJohri/3cfe604959621ddeb0ee0b5b54cf98f8 to your computer and use it in GitHub Desktop.

Select an option

Save AlJohri/3cfe604959621ddeb0ee0b5b54cf98f8 to your computer and use it in GitHub Desktop.
const readline = require('readline');
const arr = [];
const rl = readline.createInterface({
input: fs.createReadStream(path)
});
rl.on('line', function (line) {
arr.push(JSON.parse(line));
}).on('close', function() {
rl.close();
console.log(arr[0]);
console.log(arr.length);
// do your work here
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment