Nixmem

May 21, 2020 · View on GitHub

N-API version Maintenance mit dep size Known Vulnerabilities Build Status

SlimIO Nixmem is a Node.js binding which bring information about memory consumption. This module has been designed for UNIX systems (For windows please take a look at Winmem).

LinuxBSDSunOs
✔️✔️✔️

Requirements

  • Node.js v12 or higher
  • UNIX system.

Getting Started

This package is available in the Node Package Repository and can be easily installed with npm or yarn.

$ npm i @slimio/nixmem
# or
$ yarn add @slimio/nixmem

Usage example

const { getSysInfo } = require("@slimio/nixmem");

async function main() {
    const sysInfo = await getSysInfo();
    console.log(sysInfo());
}
main().catch(console.error);

API

getSysInfo(): Promise< MemInfo >

SysInfo will return information about your local memory consumption. The method will return data with a MemInfo interface:

interface MemInfo {
    memTotal: number;
    memFree: number;
    memShared: number;
    memAvailable: number;
    swapCached: number;
    swapTotal: number;
    swapFree: number;
    anonPages: number;
    pageTables: number;
    shmemHugePages: number;
    shmemPmdMapped: number;
    hugePagesTotal: number;
    hugePagesFree: number;
    hugePagesRsvd: number;
    hugePagesSurp: number;
    hugePageSize: number;
    commitLimit: number;
    vMallocTotal: number;
    vMallocUsed: number;
    vMallocChunk: number;
}

Contribution Guidelines

To contribute to the project, please read the code of conduct and the guide for N-API compilation.

Dependencies

NameRefactoringSecurity RiskUsage
node-addon-api⚠️MajorLowNode.js C++ addon api
node-gyp-build⚠️MajorLowNode-gyp builder

License

MIT