zklib
Version:
Attendance Machine Library for NodeJS with a connection to the network using the UDP protocol and port 4370
28 lines (23 loc) • 493 B
JavaScript
const dgram = require('dgram');
const {Commands} = require('./constants');
module.exports = class {
/**
*
* @param {(error: Error, data:string) => void} [cb]
*/
version(cb) {
const keyword = '~ZKFPVersion';
this.executeCmd(Commands.DEVICE, keyword, (err, ret) => {
if (err) {
return cb(err);
}
return cb(
null,
ret
.slice(8)
.toString('ascii')
.replace(keyword + '=', '')
);
});
}
};