free-memory

1.0.0 • Public • Published

node-free-memory

Gets system memory information (from free) in a nicely formatted way.

Usage

var free = require("free-memory")
 
free(function (err, info) {
 
    console.log(info);
    /* Outputs:
    {
        mem: {
            total: 7663792,
            used: 6297348,
            free: 1366444,
            shared: 170644,
            buffers: 1672100,
            cached: 2042312,
            usable: 5080856 // free + buffers + cached
        },
        buffers: {
            used: 2582936,
            free: 5080856
        },
        cache: {
            used: 2582936,
            free: 5080856,
        },
        swap: {
            total: 8307708,
            used: 500,
            free: 8307208
        }
    }
    */
 
});
 
  • All values are integers in Kb, same as free output. Divide by 1024 to get MB.
  • mem.usable is same as mem.free + mem.buffers + mem.cached
  • buffers and cache are the same values.

Package Sidebar

Install

npm i free-memory

Weekly Downloads

133

Version

1.0.0

License

MIT

Last publish

Collaborators

  • timjrobinson