in indigo.js [1354:1365]
IndigoObject.prototype.toBuffer = function() {
this.d._setSessionId();
let size = alloc('int');
let pointer = alloc(refType('byte'));
this.d._checkResult(this.d._lib.indigoToBuffer(this.id, pointer, size));
let buf = readPointer(pointer, 0, size.deref());
let res = [];
for (let i = 0; i < size.deref(); i++) {
res.push(buf[i]);
}
return res;
};