I already use ref module in a full Node.js (7.9.0) environnement. I do the following thing without any trouble:
let size = Buffer.alloc(4, 0);size.type = ref.types.uint;console.log('size:', size.deref());
Now I try to execute the same code in electron runtime (with the same Node version) and I get a different behaviour. This time size.deref is undefined. Indeed there is no deref filed in size.__proto__.
The only difference I could see with console.log is that my buffer instance is a Uint8Array in the electron runtime, but when I check Buffer.isBuffer(size) I get true.
Example:
let size: any = Buffer.alloc(4, 0);size.type = ref.types.uint;console.log('size:', size, JSON.stringify(size));console.log('size.deref:', size.deref);console.log('size.type:', size.type);console.log('isBuffer:', Buffer.isBuffer(size));
Any ideas?
Thanks
PS: great job! FFI and REF are really cool!
Hi,
I already use ref module in a full Node.js (7.9.0) environnement. I do the following thing without any trouble:
let size = Buffer.alloc(4, 0);
size.type = ref.types.uint;
console.log('size:', size.deref());
Now I try to execute the same code in electron runtime (with the same Node version) and I get a different behaviour. This time
size.deref
is undefined. Indeed there is no deref filed insize.__proto__
.The only difference I could see with console.log is that my buffer instance is a Uint8Array in the electron runtime, but when I check
Buffer.isBuffer(size)
I get true.Example:
let size: any = Buffer.alloc(4, 0);
size.type = ref.types.uint;
console.log('size:', size, JSON.stringify(size));
console.log('size.deref:', size.deref);
console.log('size.type:', size.type);
console.log('isBuffer:', Buffer.isBuffer(size));
Any ideas?
Thanks PS: great job! FFI and REF are really cool!