Skip to content

Instantly share code, notes, and snippets.

@Jamelle-Boose
Created August 2, 2022 16:53
Show Gist options
  • Save Jamelle-Boose/31f99437788fe180d6e016cd803af846 to your computer and use it in GitHub Desktop.
Save Jamelle-Boose/31f99437788fe180d6e016cd803af846 to your computer and use it in GitHub Desktop.
Get process memory usage
const fs = require('fs');
const allFileContents = fs.readFileSync('broadband.sql', 'utf-8');
allFileContents.split(/\r?\n/).forEach(line => {
console.log(`Line from file: ${line}`);
});
const used = process.memoryUsage().heapUsed / 1024 / 1024;
console.log(`The script uses approximately ${Math.round(used * 100) / 100} MB`);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment