nstats
Advanced tools
Comparing version 4.0.0 to 4.1.0
@@ -5,3 +5,3 @@ const fp = require('fastify-plugin') | ||
{ | ||
constructor(ws, httpServer) | ||
constructor(ws, httpServer, server_version) | ||
{ | ||
@@ -14,2 +14,3 @@ this.clients = ws.clients || null; | ||
this.data = { | ||
server_version, | ||
uptime: 0, | ||
@@ -436,10 +437,18 @@ totalMemory: 0, | ||
var nstats; | ||
const fs = require('fs'); | ||
module.exports = function(ws, httpServer) | ||
module.exports = function(ws, httpServer, server_version) | ||
{ | ||
if(!nstats) | ||
{ | ||
if(!server_version) { | ||
try { | ||
server_version = require(process.cwd()+'/package.json').version; | ||
} catch (e) { | ||
server_version = '0.0.0' | ||
} | ||
} | ||
nstats = new NStats(ws || | ||
{}, httpServer || null); | ||
{}, httpServer || null, server_version); | ||
} | ||
@@ -446,0 +455,0 @@ |
{ | ||
"name": "nstats", | ||
"version": "4.0.0", | ||
"version": "4.1.0", | ||
"description": "A fast and compact way to get all your network and process stats for your node application.", | ||
@@ -5,0 +5,0 @@ "main": "nstats.js", |
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
52731
2011
2