{"id":13670845,"url":"https://github.com/oscmejia/os-utils","last_synced_at":"2026-01-11T03:53:52.702Z","repository":{"id":4151889,"uuid":"5265913","full_name":"oscmejia/os-utils","owner":"oscmejia","description":"OS Utils","archived":false,"fork":false,"pushed_at":"2022-04-22T05:47:12.000Z","size":17,"stargazers_count":239,"open_issues_count":11,"forks_count":39,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-11-01T21:04:23.768Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/oscmejia.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-08-01T23:02:05.000Z","updated_at":"2024-10-15T13:29:36.000Z","dependencies_parsed_at":"2022-08-29T21:01:28.920Z","dependency_job_id":null,"html_url":"https://github.com/oscmejia/os-utils","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oscmejia%2Fos-utils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oscmejia%2Fos-utils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oscmejia%2Fos-utils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oscmejia%2Fos-utils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oscmejia","download_url":"https://codeload.github.com/oscmejia/os-utils/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224073324,"owners_count":17251250,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T09:00:50.451Z","updated_at":"2026-01-11T03:53:52.655Z","avatar_url":"https://github.com/oscmejia.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"os-utils\n========\n\nAn operating system utility library. Some methods are wrappers of node libraries\nand others are calculations made by the module.\n\n\n## Installation\n\nOne line installation with [npm](http://npmjs.org). \n```bash\nnpm install os-utils\n```\n\nThen in your code \n```js\nvar os \t= require('os-utils');\n\n\nos.cpuUsage(function(v){\n\tconsole.log( 'CPU Usage (%): ' + v );\n});\n\nos.cpuFree(function(v){\n\tconsole.log( 'CPU Free:' + v );\n});\n```\n\n\n## Usage\n\nThe following methods are available:\n\n\n### Calculate CPU usage for the next second\nThis is not an average of CPU usage like it is in the \"os\" module. The callback will receive a parameter with the value.\n```js\nos.cpuUsage( function(value) { /* ... */ } );\n```\n\t\n\n### Calculate free CPU for the next second\nThis is not based on average CPU usage like it is in the \"os\" module. The callback will receive a parameter with the value.\n```js\nos.cpuFree( function(value) { /* ... */ } );\n```\n\n\t\n### Get the platform name\n```js\nos.platform();\n```\n\n\n### Get number of CPUs\n```js\nos.cpuCount()\n```\n\n\n### Get current free memory\n```js\nos.freemem()\n```\n\n\n### Get total memory\n```js\nos.totalmem()\n```\n\n\n### Get a current free memory percentage\n```js\nos.freememPercentage()\n```\n\n\n### Get the number of seconds the system has been running for\n```js\nos.sysUptime();\n```\n\t\n\t\n### Get the number of seconds the process has been running\n```js\nos.processUptime() \n```\n\n\n### Get average load for 1, 5 or 15 minutes\n```js\nos.loadavg(1)\nos.loadavg(5)\nos.loadavg(15)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foscmejia%2Fos-utils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foscmejia%2Fos-utils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foscmejia%2Fos-utils/lists"}