Skip to content

Instantly share code, notes, and snippets.

@ZacharyL2
Created August 21, 2022 07:48
Show Gist options
  • Save ZacharyL2/d2f839cd126773591d79384e9ee8815b to your computer and use it in GitHub Desktop.
Save ZacharyL2/d2f839cd126773591d79384e9ee8815b to your computer and use it in GitHub Desktop.
console.time('Time');
const fs = require('fs');
const readline = require('readline');
void (async () => {
const rl = readline.createInterface({
input: fs.createReadStream('test.json'),
crlfDelay: Infinity,
});
rl.on('line', (line) => {
// console.log('line: ', line);
});
await new Promise((res) => rl.once('close', res));
console.log(`Used ${process.memoryUsage().heapUsed / 1024 / 1024} MB`);
console.timeEnd('Time');
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment