Skip to content

Instantly share code, notes, and snippets.

@cxreg
Created February 7, 2013 20:18
Show Gist options
  • Save cxreg/4733820 to your computer and use it in GitHub Desktop.
Save cxreg/4733820 to your computer and use it in GitHub Desktop.
actual memory free
fs.readFile('/proc/meminfo', 'utf8', function (err, str) {
var fields = {};
str.split('\n').forEach(function (line) {
var parts = line.split(':');
if (parts.length === 2) {
fields[parts[0]] = parts[1].trim().split(' ', 1)[0];
}
});
cb(fields['MemTotal'] + fields['Buffers'] + fields['Cached']);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment