{"id":16834707,"url":"https://github.com/mscdex/xsys","last_synced_at":"2025-04-11T04:35:08.982Z","repository":{"id":3337595,"uuid":"4381760","full_name":"mscdex/xsys","owner":"mscdex","description":"A node.js binding to useful system-level functions","archived":false,"fork":false,"pushed_at":"2013-08-04T12:17:19.000Z","size":52,"stargazers_count":5,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-11T04:35:01.646Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C++","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/mscdex.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-05-20T00:21:25.000Z","updated_at":"2017-11-10T17:05:20.000Z","dependencies_parsed_at":"2022-09-07T16:14:28.490Z","dependency_job_id":null,"html_url":"https://github.com/mscdex/xsys","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mscdex%2Fxsys","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mscdex%2Fxsys/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mscdex%2Fxsys/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mscdex%2Fxsys/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mscdex","download_url":"https://codeload.github.com/mscdex/xsys/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248345258,"owners_count":21088231,"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-10-13T12:07:30.097Z","updated_at":"2025-04-11T04:35:08.956Z","avatar_url":"https://github.com/mscdex.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"\nDescription\n===========\n\nA [node.js](http://nodejs.org/) binding to useful system-level functions.\n\n\nRequirements\n============\n\n* [node.js](http://nodejs.org/) -- v0.6.0 or newer\n\n\nInstall\n============\n\nnpm install xsys\n\n\nExamples\n========\n\n* Get filesystem total/free/used byte counts:\n```javascript\n  var fs = require('xsys').fs;\n\n  // format our numerical output\n  function fmtBytes(val) {\n      return val.toString().replace(/\\B(?=(\\d{3})+(?!\\d))/g, ',');\n  }\n\n  fs.getTotal(function(err, n) {\n      if (err) throw err;\n      console.log('Total bytes for current volume: ' + fmtBytes(n));\n  });\n  fs.getFree(function(err, n) {\n      if (err) throw err;\n      console.log('Free bytes for current volume: ' + fmtBytes(n));\n  });\n  fs.getUsed(function(err, n) {\n      if (err) throw err;\n      console.log('Used bytes for current volume: ' + fmtBytes(n));\n  });\n\n  // sample output:\n  //\n  // Total bytes for current volume: 974,656,999,424\n  // Free bytes for current volume: 877,061,001,216\n  // Used bytes for current volume: 48,814,333,952\n```\n\n\nAPI\n===\n\nStatic Methods\n--------------\n\n* **fs.getTotal**([\u003c_String_\u003epath,] \u003c_Function_\u003ecallback) - _(void)_ - Retrieves the number of total bytes on the volume where *path* is located (defaults to path of the module). The callback receives two arguments: an \u003c_Error_\u003e object in case of error (null otherwise) and a \u003c_String_\u003e containing the number of bytes.\n\n* **fs.getTotalSync**([\u003c_String_\u003epath]) - \u003c_String_\u003e - Synchronous version of getTotal().\n\n* **fs.getFree**([\u003c_String_\u003epath,] \u003c_Function_\u003ecallback) - _(void)_ - Retrieves the number of free bytes on the volume where *path* is located (defaults to path of the module). The callback receives two arguments: an \u003c_Error_\u003e object in case of error (null otherwise) and a \u003c_String_\u003e containing the number of bytes.\n\n* **fs.getFreeSync**([\u003c_String_\u003epath]) - \u003c_String_\u003e - Synchronous version of getFree().\n\n* **fs.getUsed**([\u003c_String_\u003epath,] \u003c_Function_\u003ecallback) - _(void)_ - Retrieves the number of used bytes on the volume where *path* is located (defaults to path of the module). The callback receives two arguments: an \u003c_Error_\u003e object in case of error (null otherwise) and a \u003c_String_\u003e containing the number of bytes.\n\n* **fs.getUsedSync**([\u003c_String_\u003epath]) - \u003c_String_\u003e - Synchronous version of getUsed().\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmscdex%2Fxsys","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmscdex%2Fxsys","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmscdex%2Fxsys/lists"}