UNPKG

poweroff-tool

Version:

This is application which power off a pc when it triggered

24 lines (22 loc) 596 B
const { StringDecoder } = require('string_decoder'); const decoder = new StringDecoder('utf8'); // Async function module.exports = (varbinds, callback) => { console.time('condition -check') try { for (var i = 0; i < varbinds.length; i++) { if (varbinds[i].type === 4) { if (Buffer.isBuffer(varbinds[i].value)) { if (decoder.write(varbinds[i].value) === "true") { callback(null, true); return; } } } } } catch (err) { console.log(err); } callback(null, false); console.timeEnd('condition -check'); }