A library to help monitor operating system memory. Has typescript support!
npm install memmonit --save
Each method takes as a parameter the unit that wants to receive the memory information. The available units are Kilobyte (kB), Megabyte (MB) and Gigabytes (GB).
let memmonit = require("memmonit").MemoryMonitoring;
let memoryUsage = memmonit.getMemoryUsage("GB");
console.log(memoryUsage); //2.015354681
let memoryUsageTrunc = memmonit.memoryUsageTrunc("GB");
console.log(memoryUsageTrunc); //2
let memoryUsageFixed = memmonit.getMemoryUsageFixed("GB", 2);
console.log(memoryUsageFixed); //2.02
let memmonit = require("memmonit").MemoryMonitoring;
let memoryTotal = memmonit.getMemoryTotal("GB");
console.log(memoryTotal); //15.364312
let memoryTotalTrunc = memmonit.getMemoryTotalTrunc("GB");
console.log(memoryTotalTrunc); //15
let memoryTotalFixed = memmonit.getMemoryTotalFixed("GB", 2);
console.log(memoryTotalFixed); //15.36
- Records the memory monitoring in the file passed in the first parameter of the method
let memmonit = require("memmonit").RegisterMonitoring;
memmonit.registerMemoryUsage("./test.txt", "GB")
memmonit.registerMemoryUsageTrunc("./test.txt", "GB")
memmonit.registerMemoryUsageFixed("./test.txt", "GB")