File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -110,6 +110,20 @@ Return Device Hostname.
110110
111111Return device MAC address.
112112
113+ ## Dumping all ReadyNAS messages
114+
115+ ```
116+ node node_modules/raidar/dumper optional/target/folder
117+ ```
118+
119+ Default target folder is under node_modules ` raidar ` folder.
120+
121+ ## Running test
122+
123+ ```
124+ node node_modules/raidar/dumper
125+ ```
126+
113127## License
114128
115129MIT
Original file line number Diff line number Diff line change @@ -29,6 +29,8 @@ fs.mkdir(folder, function(err) {
2929 process . exit ( ) ;
3030} ) ;
3131
32+ console . log ( 'Sleep for 10 seconds...' ) ;
33+
3234setTimeout ( function ( ) {
3335 console . log ( 'END' ) ;
3436 process . exit ( ) ;
Original file line number Diff line number Diff line change 11{
22 "name" : " raidar" ,
3- "version" : " 0.2.0 " ,
3+ "version" : " 0.2.1 " ,
44 "description" : " NetGear RAIDar node.js implementation" ,
55 "main" : " index.js" ,
66 "scripts" : {
Original file line number Diff line number Diff line change 11var raidar = require ( './index' ) ;
22
3- console . log ( 'Setting up callbacks...' ) ;
4-
5- raidar . on ( 'error' , function ( err ) {
6- console . log ( 'ERROR' , err ) ;
7- } ) ;
8-
9- raidar . on ( 'device' , function ( device ) {
10- console . log ( 'Response from ' + device . ip + ' - ' + device . hostname + ' (' + device . mac + ')' ) ;
11- } ) ;
12-
13- console . log ( 'Opening UDP socket...' ) ;
14-
15- raidar . open ( function ( ) {
16-
17- console . log ( 'Testing for 10 seconds...' ) ;
18-
19- raidar . request ( ) ;
20-
21- setTimeout ( function ( ) {
22- process . exit ( ) ;
23- } , 10000 ) ;
24-
3+ console . log ( 'Sleep for 10 seconds...' ) ;
4+
5+ raidar . request ( 10000 , function ( err , devices ) {
6+ if ( err ) {
7+ console . log ( err ) ;
8+ } else if ( ! devices . length ) {
9+ console . log ( 'No ReadyNAS devices found...' ) ;
10+ } else {
11+ console . log ( 'Founded ' + devices . length + ' devices!' ) ;
12+ }
13+
14+ process . exit ( ) ;
2515} ) ;
You can’t perform that action at this time.
0 commit comments