enmap-memory

0.0.4-dev • Public • Published

Enmap Memory Usage Database

This Is A Simple Memory Usage Enmap Database To See How Your Database Is Preforming Memory Usage Wise

Getting It Installed

npm install enmap-memory

Getting Your Workspace Ready

While Getting Your Memory Usage Database Ready You Want To Call The Following In The Beginning Of Your Code

const Discord = require("discord.js")
const Enmap = require("enmap")
const EnmapLevel = require("enmap-level")
const client = new Discord.Client()

Calling The Enmap Database

In Order To Receive Any Accurate Memory Usage Total From Your Database You Want To Call The Following Anywhere In Your Code

const level = new EnmapLevel({ name: 'DatabaseName' });
const myColl = new Enmap({ provider: level });

Getting Your Memory Usage Total

Under You Called The Database You Want To Include This Code So It'll Measure Your Memory Usage When You First Start The Database

const MemoryUsage = [`${(process.memoryUsage().heapUsed / 1024 / 1024).toFixed(2)}`]

return console.log(`${MemoryUsage}`);

Forcing An Exit On High Memory

Since Version 0.0.1 Of Enmap-Memory Will Have Some Slight Issues, We Allow It To Force An Exit When It Get's Too High If Not Bad Things Will Come About So Insert The Following Anywhere

// If Memory Get's Too High Than Normal Memory Usage Limit It'll Automataclly Exit The Process Of Working
client.on("debug", () => {
return console.log(`Memory Was Too High So Forcing An Exit - Current Memory Usage: ${(process.memoryUsage().heapUsed / 1024 / 1024).toFixed(2)}`);
 process.exit(1)
});

Other Information

When Starting The Project, It'll Only Record The Current Memory Usage When Starting If You Want To Monitor It Fully Simply Install PM2 Then Run Command pm2 monitor index.js

Readme

Keywords

Package Sidebar

Install

npm i enmap-memory

Weekly Downloads

1

Version

0.0.4-dev

License

MIT

Unpacked Size

36.5 kB

Total Files

15

Last publish

Collaborators

  • pilav