{"id":21522217,"url":"https://github.com/greguz/node-raidar","last_synced_at":"2025-04-09T22:23:31.844Z","repository":{"id":28350252,"uuid":"31863913","full_name":"greguz/node-raidar","owner":"greguz","description":"NetGear RAIDar Node.js implementation","archived":false,"fork":false,"pushed_at":"2022-12-30T18:31:36.000Z","size":218,"stargazers_count":7,"open_issues_count":9,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-24T00:16:50.911Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/greguz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-03-08T20:15:33.000Z","updated_at":"2024-02-14T15:54:48.000Z","dependencies_parsed_at":"2023-01-14T08:40:38.745Z","dependency_job_id":null,"html_url":"https://github.com/greguz/node-raidar","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/greguz%2Fnode-raidar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/greguz%2Fnode-raidar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/greguz%2Fnode-raidar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/greguz%2Fnode-raidar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/greguz","download_url":"https://codeload.github.com/greguz/node-raidar/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247846593,"owners_count":21006071,"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-11-24T01:09:37.557Z","updated_at":"2025-04-09T22:23:31.822Z","avatar_url":"https://github.com/greguz.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# node-raidar: a Node.js NetGear RAIDar library\n\n[![npm version](https://badge.fury.io/js/raidar.svg)](https://badge.fury.io/js/raidar) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)\n\n`raidar` is a simple to use NetGear RAIDar implementation for Node.js.\n\n\n\n## Installing\n\n### NPM\n\n```\nnpm install --save raidar\n```\n\n### Yarn\n\n```\nyarn add raidar\n```\n\n\n\n## Examples\n\n### One shot\n\n``` js\n// require lib\nvar raidar = require('raidar')\n\n// request devices\nraidar.request(function (err, devices) {\n\n  // handle error\n  if (err) console.error(err)\n\n  // do something useful\n  else console.log('ReadyNAS devices found:', devices.length)\n\n})\n```\n\n### Events\n\n``` js\n// require lib\nvar raidar = require('raidar')\n\n// listen for all devices\nraidar.on('device', function (device) {\n\n  // do something cool\n  console.log('Reponse from', device.hostname())\n\n})\n\n// handle all errors\nraidar.on('error', function (err) {\n\n  // log error\n  console.error(err)\n\n})\n\n// listen single device by IP\nraidar.on('192.168.1.10', function (device) { ... })\n\n// listen single device by hostname\nraidar.on('nas-acme', function (device) { ... })\n\n// listen single device by MAC address\nraidar.on('aa:bb:cc:dd:ee:ff', function (device) { ... })\n\n// perform request\nraidar.request()\n```\n\n\n\n## ReadyNAS (device) class\n\nRepresentation of a ReadyNAS device.\n\n### Device info APIs\n\n#### mac() : {String}\n\nGet device MAC address.\n\n#### hostname() : {String}\n\nGet device hostname.\n\n#### ip() : {String}\n\nGet device IP.\n\n#### serial() : {String}\n\nGet device serial number.\n\n#### version() : {String}\n\nGet loaded firmware version.\n\n### Disks info APIs\n\n#### diskCount() : {Number}\n\nGet number of loaded disks.\n\n#### diskInfo({Number} index, {String} [attribute='status']) : {String|Number}\n\nGet info of a particular disk, *index* starts from 1.\n\n| Attribute   | Return type | Description               |\n| ----------- | ----------- | ------------------------- |\n| status      | {String}    | 'ok', 'warn', 'dead' or ? |\n| channel     | {Number}    | HDD channel               |\n| model       | {String}    | HDD model                 |\n| celsius     | {Number}    | temperature in celsius    |\n| fahrenheit  | {Number}    | temperature in fahrenheit |\n\n### Volumes info APIs\n\n#### volumeCount() : {Number}\n\nGet number of configured volumes.\n\n#### volumeInfo({Number} index, {String} [attribute='status']) : {String|Number}\n\nGet info of a particular volume, *index* starts from 1.\n\n| Attribute | Return type | Description           |\n| --------- | ----------- | --------------------- |\n| status    | {String}    | 'ok', 'warn' or ?     |\n| level     | {String}    | RAID level            |\n| message   | {String}    | Status description    |\n| size      | {Number}    | Volume size in bytes  |\n| used      | {Number}    | Used space in bytes   |\n| free      | {Number}    | Free space in bytes   |\n\n### Other APIs\n\n#### getEntities() : {Array}\n\nGet all device entities.\n\n#### getEntity({String} entity, {Number} [index]) : {Object}\n\nGet entity data.\n\n#### getEntityAttribute({String} entity, {Number} [index], {String} attribute) : {*}\n\nGet single entity attribute.\n\n#### toJSON() : {Object}\n\nGet {Object} representation of ReadyNAS device.\n\n\n\n## RAIDar class\n\nHandle network data collection.\n\n### APIs\n\n#### raidar.isOpen() : {Boolean}\n\nCheck if the UDP socket is open.\n\n#### raidar.open({Function} [callback])\n\nOpen a new UPD socket, *callback* has no arguments.\n\n#### raidar.close({Function} [callback])\n\nClose the UDP socket, *callback* has no arguments.\n\n#### raidar.request({Object} [options], {Function} [callback])\n\nPerform a new ReadyNAS request, if the socket is closed it will be opened.\n\n*callback* is called as `callback({Error} [err], {Array} devices)`.\n\n| Option  | Type      | Description                           |\n| ------- | --------- | ------------------------------------- |\n| address | {String}  | Do request to a specific IP/hostname  |\n| timeout | {Number}  | Idle timeout to stop request          |\n\n### Events\n\n#### raidar.on('listening', function () { ... })\n\nTriggered whenever a socket begins listening for datagram messages.\n\n#### raidar.on('close', function () { ... })\n\nTriggered after a socket is closed with *#close()* API.\n\n#### raidar.on('error', function ({Error} err) { ... })\n\nTriggered where an error occurs.\n\n#### raidar.on('fail', function ({Error} err, {Buffer} message) { ... })\n\nTriggered after a error on ReadyNAS instance.\n\n#### raidar.on('message', function ({Buffer} message) { ... })\n\nClean reponse from a ReadyNAS device.\n\n#### raidar.on('device', function (device) { ... })\n\nTriggered when a ReadyNAS device is found, with a instance of ReadyNAS class.\n\n#### raidar.on('[IP]', function (device) { ... })\n\nSame as *device* event, but triggered when a specific device is found.\n\n#### raidar.on('[hostname]', function (device) { ... })\n\nSame as *device* event, but triggered when a specific device is found.\n\n#### raidar.on('[MAC address]', function (device) { ... })\n\nSame as *device* event, but triggered when a specific device is found.\n\n\n\n## CLI\n\n### Usage\n\n```\nUsage: raidar [options]\n\nOptions:\n  -h, --help               output usage information\n  -V, --version            output the version number\n  -a, --address \u003caddress\u003e  perform a request to a particular hostname/IP\n  -t, --timeout \u003cn\u003e        set a request idle timeout, default 3 seconds\n  -f, --fahrenheit         display temperature in fahrenheit instead of celsius\n  -d, --dump [path]        dump ReadyNAS messages\n  -j, --json               print JSON format\n  -F, --fake \u003cpath\u003e        emulate a fake device from dump\n```\n\n### Output\n\n```\nReadyNAS 104 - 0123456789ABC\n  mac   aa:bb:cc:dd:ee:ff\n  ip    192.168.1.5\n  name  acme-swhouse\n  fw    6.6.1\n  Disks\n  ✓ WDC_WD40EFRX-68WT0N0 4TB - 55°C\n  ✓ WDC_WD40EFRX-68WT0N0 4TB - 40°C\n  Volumes\n  ✓ RAID lv.1 - 27% used\n    Redundant\n```\n\nPS: the output is colored ;)\n\n\n\n## Help me, bro !\n\n* Have some problems ?\n* Have over 9000 NetGear NASses ?\n* Have some strange errors with some APIs ?\n\nDump all ReadyNAS messages and send it to me to help me to understand the ReadyNAS protocol.\n\n\n\n## Test\n\n```\nnpm run test\n```\n\n\n## License\n\nCopyright 2019 Giacomo Gregoletto\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgreguz%2Fnode-raidar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgreguz%2Fnode-raidar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgreguz%2Fnode-raidar/lists"}