Gathering detailed insights and metrics for node-nut
Gathering detailed insights and metrics for node-nut
Gathering detailed insights and metrics for node-nut
Gathering detailed insights and metrics for node-nut
@nut-tree/libnut
libnut is an N-API module for desktop automation with node
@nut-tree/libnut-darwin
libnut is an N-API module for desktop automation with node
@nut-tree/libnut-linux
libnut is an N-API module for desktop automation with node
@nut-tree/libnut-win32
libnut is an N-API module for desktop automation with node
npm install node-nut
Typescript
Module System
Min. Node Version
Node Version
NPM Version
73.1
Supply Chain
99.3
Quality
75.2
Maintenance
100
Vulnerability
100
License
JavaScript (100%)
Total Downloads
231,707
Last Day
14
Last Week
516
Last Month
1,993
Last Year
35,873
MIT License
13 Stars
45 Commits
10 Forks
4 Watchers
1 Branches
5 Contributors
Updated on Jul 03, 2024
Minified
Minified + Gzipped
Latest Version
1.0.3
Package Id
node-nut@1.0.3
Unpacked Size
17.89 kB
Size
4.34 kB
File Count
4
NPM Version
3.5.2
Node Version
8.10.0
Cumulative downloads
Total Downloads
No dependencies detected.
Node-NUT is a NodeJS module that implements a NUT (Network UPS Tools) client.
v1.0.0 introduce callbacks into all functions including a second "error" parameter. This error parameter is null on success or a text on error. Please see the updated method documentation below.
This change should not break existing code because you can simply ignore the second parameter, but there is one change coming with it:
When with v0.0.x an error occured in one of the "Get-List-Of" methods then the callback was pot. never called at all. This has changed now because now the callback is also called in errorcases, but then with an empty object/list in return. So you may want to include error handling code that not strange things happens in error cases.
This event is emitted when the connection to the NUT server is established.
Emitted when there was an error establishing the connection or with the network communication to the server.
Emitted when the connection to the NUT server is closed.
start()
Starts the connection to the server.
GetUPSList (callback)
Calls the callback
function with the list of UPS as an object as the first parameter. If the second parameter is not null then an error happened and the first object is returned as null.
Keys in the object are the UPS names and the values are the provided description for this UPS.
GetUPSVars (upsname, callback)
Calls the callback
function with the list of VARs of upsname
as an object as the first parameter. If the second parameter is not null then an error happened and the first object is returned as null.
Keys in the object are the VAR names and the values are the current VAR values.
GetUPSCommands (upsname, callback)
Calls the callback
function with the list of COMMANDs available in upsname
as an array as the first parameter. If the second parameter is not null then an error happened and the first object is returned as null.
The values in the array are the available COMMANDs.
GetCommandDescription (upsname, cmdname, callback)
Calls the callback
function with the description for the given cmdname
as a string as the first parameter. If the second parameter is not null then an error happened and the first object is returned as null.
The description is returned as string.
RunUPSCommand (upsname, command, callback)
Rund the COMMAND given by command
. The callback is called with one parameter err
which is null on success or contains an error string on error and can be used to check the result of the call.
Note: Some commands need to set Username and Password before, else it returns an Error! Please consult the documentation of your UPS system.
SetUsername (username, callback)
Set the password for the connection. The callback is called with one parameter err
which is null on success or contains an error string on error and can be used to check the result of the call.
Note: Incorrect values may not generate an error when setting the username, but when executing the command later on!
SetPassword (password, callback)
Set the password for the connection. The callback is called with one parameter err
which is null on success or contains an error string on error and can be used to check the result of the call.
Note: Incorrect values may not generate an error when setting the password, but when executing the command later on!
GetRWVars (upsname, callback)
Calls the callback
function with the list of RW-VARs of upsname
as an object as the first parameter. If the second parameter is not null then an error happened and the first object is returned as null.
Keys in the object are the RW-VAR names and the values are the current RW-VAR values.
SetRWVar (upsname, varname, value, callback)
Set the value of the RW-VAR given by varname
. The callback is called with one parameter err
which is null on success or contains an error string on error and can be used to check the result of the call.
GetVarType (upsname, varname, callback)
Calls the callback
function with the type for the given varname
as a string as the first parameter. If the second parameter is not null then an error happened and the first object is returned as null.
The following types are defined, and multiple words may be returned:
For more details see http://networkupstools.org/docs/developer-guide.chunked/ar01s09.html#_type
GetVarDescription (upsname, varname, callback)
Calls the callback
function with the description for the given varname
as a string as the first parameter. If the second parameter is not null then an error happened and the first object is returned as null.
The description is returned as string.
GetEnumsForVar (upsname, varname, callback)
Calls the callback
function with the list of allowed ENUM values for the given varname
as an array as the first parameter. If the second parameter is not null then an error happened and the first object is returned as null.
The values in the array are the available ENUMs.
GetRangesForVar (upsname, varname, callback)
Calls the callback
function with the list of allowed RANGEs for the values for the given varname
as an array as the first parameter. If the second parameter is not null then an error happened and the first object is returned as null.
The values in the array are objects with the keys min
and max
for the various ranges.
Master (upsname, callback)
Send the MASTER command to the given upsname
. The callback is called with one parameter err
which is null on success or contains an error string on error and can be used to check the result of the call.
FSD (upsname, callback)
Send the FSD command to the given upsname
. The callback is called with one parameter err
which is null on success or contains an error string on error and can be used to check the result of the call.
ListClients (upsname)
help(callback)
Call the callback
function with the result of the command help
as a string.
ver (callback)
Call the callback
function with the version of the server as a string.
netVer (callback)
Call the callback
function with the version of the network protocol as a string.
1var Nut = require('node-nut'); 2 3oNut = new Nut(3493, 'localhost'); 4 5oNut.on('error', function(err) { 6 console.log('There was an error: ' + err); 7}); 8 9oNut.on('close', function() { 10 console.log('Connection closed.'); 11}); 12 13oNut.on('ready', function() { 14 self = this; 15 this.GetUPSList(function(upslist, err) { 16 if (err) console.log('Error: ' + err) 17 console.log(upslist); 18 self.close(); 19 }); 20}); 21 22oNut.start();
Protocol: http://networkupstools.org/docs/developer-guide.chunked/ar01s09.html
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 4/10 approved changesets -- score normalized to 4
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-06-23
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn MoreLast Day
-53.3%
14
Compared to previous day
Last Week
-10.4%
516
Compared to previous week
Last Month
8.1%
1,993
Compared to previous month
Last Year
29.1%
35,873
Compared to previous year