Skip to content

timjrobinson/node-free-memory

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

node-free-memory

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

Installation

npm install --save free-memory

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.

Test

npm test

License

MIT

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published