refactor: use Buffer.from and Buffer.alloc instead of new Buffer() (#957)

This commit is contained in:
Róbert Kiss
2019-05-29 21:56:01 +02:00
committed by László Monda
parent 999feea488
commit 82c9126d82
24 changed files with 47 additions and 47 deletions
+1 -1
View File
@@ -3,7 +3,7 @@ const uhk = require('./uhk');
const device = uhk.getUhkDevice();
function readKeyboardState() {
const payload = new Buffer([uhk.usbCommands.getDeviceState]);
const payload = Buffer.from([uhk.usbCommands.getDeviceState]);
console.log('Sending ', uhk.bufferToString(payload));
device.write(uhk.getTransferData(payload));
const receivedBuffer = device.readSync();