Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

os-utils

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

os-utils - npm Package Compare versions

Comparing version 0.0.13 to 0.0.14

40

lib/osutils.js

@@ -37,2 +37,24 @@ var _os = require('os');

exports.freeCommand = function(callback){
// Only Linux
require('child_process').exec('free -m', function(error, stdout, stderr) {
var lines = stdout.split("\n");
var str_mem_info = lines[1].replace( /[\s\n\r]+/g,' ');
var mem_info = str_mem_info.split(' ')
total_mem = parseFloat(mem_info[1])
free_mem = parseFloat(mem_info[3])
buffers_mem = parseFloat(mem_info[5])
cached_mem = parseFloat(mem_info[6])
used_mem = total_mem - (free_mem + buffers_mem + cached_mem)
callback(used_mem -2);
});
}

@@ -75,5 +97,7 @@

command = 'ps aux | head -n '+ 11
command = 'ps -eo pcpu,pmem,time,args | sort -k 1 -r | head -n'+10
//command = 'ps aux | head -n '+ 11
//command = 'ps aux | head -n '+ (nProcess + 1)
if (nProcess > 0)
command = 'ps aux | head -n '+ (nProcess + 1)
command = 'ps -eo pcpu,pmem,time,args | sort -k 1 -r | head -n'+(nProcess + 1)

@@ -85,2 +109,3 @@ require('child_process').exec(command, function(error, stdout, stderr) {

var lines = stdout.split("\n");
lines.shift()
lines.pop()

@@ -90,13 +115,14 @@

lines.forEach(function(_item,_i){
if (_i > 0){
var _str = _item.replace( /[\s\n\r]+/g,' ');
var _str = _item.replace( /[\s\n\r]+/g,' ');
_str = _str.split(' ')
_str = _str.split(' ')
result += _str[10]+" "+_str[9]+" "+_str[2]+" "+_str[3]+"\n";
}
// result += _str[10]+" "+_str[9]+" "+_str[2]+" "+_str[3]+"\n"; // process
result += _str[1]+" "+_str[2]+" "+_str[3]+" "+_str[4].substring((_str[4].length - 25))+"\n"; // process
});
callback(result);

@@ -103,0 +129,0 @@ });

2

package.json
{
"name" : "os-utils",
"version" : "0.0.13",
"version" : "0.0.14",
"description" : "an operating-system utility library",

@@ -5,0 +5,0 @@ "url" : "http://oscar-mejia.com",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc