Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
sendScreen() {
var screen = robot.captureScreen();
var ts = Date.now();
var imgBytes = screen.width * screen.height * screen.bytesPerPixel;
var buffer = new ArrayBuffer(20 + imgBytes);
var header = new Float64Array(buffer, 0, 2);
header.set([wire.WIRE['si'], ts]);
var screenView = new Uint16Array(buffer, 16, 2);
screenView.set([ screen.width, screen.height ]);
var imgView = new Uint8Array(buffer, 20, imgBytes);
imgView.set(screen.image);
this.sendRaw(buffer);
}