Created
July 9, 2020 13:33
-
-
Save mmomtchev/329566e3b3a113bf12cb460b34989389 to your computer and use it in GitHub Desktop.
This file contains 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 fs = require('fs'); | |
const rs = fs.createReadStream('allCountries.txt'); | |
const parseline = require('./parseline'); | |
console.time(__filename); | |
let remainder = ''; | |
rs.on('data', (buf) => { | |
const lines = (remainder + buf).split(/\r?\n/g); | |
remainder = lines.pop(); | |
for (const line of lines) { | |
parseline(line); | |
} | |
}); | |
rs.on('close', () => console.timeEnd(__filename)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment