jkdb
Version:
javascript interface for kdb+/q
25 lines (20 loc) • 761 B
JavaScript
const net = require('net');
const socket = net.connect(1800, 'localhost');
socket.on('error', err => console.log(err));
socket.on('close', err => console.log(err));
socket.on('data', buffer => {
socket.write(Buffer.from('010200000a0000006500', 'hex'));
});
const userPw = 'user:password';
const n = Buffer.byteLength(userPw, 'ascii');
const b = Buffer.alloc(n + 2);
b.write(userPw, 0, n, 'ascii');
b.writeUInt8(0x3, n);
b.writeUInt8(0x0, n + 1);
socket.write(b);
const ASYNC_ACK = Buffer.from('01000000130000000a00050000002e7a2e443b', 'hex');
const SYNC_ACK = Buffer.from('010100000a0000006500', 'hex');
const MSG = Buffer.from('01020000130000000a00050000002e7a2e443b', 'hex');
// socket.write(ASYNC_ACK);
// socket.write(SYNC_ACK);
// socket.write(MSG);