Skip to content

Instantly share code, notes, and snippets.

@brycebaril
Forked from cxreg/gist:4733820
Created June 24, 2013 02:32
Show Gist options
  • Save brycebaril/5847413 to your computer and use it in GitHub Desktop.
Save brycebaril/5847413 to your computer and use it in GitHub Desktop.
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