Created
February 15, 2017 00:59
-
-
Save AlJohri/3cfe604959621ddeb0ee0b5b54cf98f8 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
| 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