hxnodejs icon indicating copy to clipboard operation
hxnodejs copied to clipboard

Current implementation of hxFromBytes incompatible with Node 4.x

Open jonasmalacofilho opened this issue 8 years ago • 1 comments

Before hxFromBytes(foo) would generate

new Buffer(foo.b.bufferValue)

but that changed with HaxeFoundation/hxnodejs@19a1e2b9af60860b0f0b9e0d5f2a933ff12c6031 (and HaxeFoundation/hxnodejs@9b24a891e640beca1bb57dea31800acafe696ebb) to

new Buffer(foo.b.bytes, foo.b.byteOffset, foo.b.byteLength)

However, the history of the new Buffer(arrayBuffer, offset, length) NodeJS constructor isn't as linear as one would hope:

NodeJS new Buffer

Since the constructor isn't supported in Node 4.x, the current implementation has the effect of calling new Buffer(foo.b.bytes), making the new buffer point to the entire underlying array buffer of foo, that will also contain data for other buffers, because of pooling.

jonasmalacofilho avatar Oct 29 '17 10:10 jonasmalacofilho

The Node.js 4.x releases are unsupported since April 2018. I think we should look to support newest LTS-Build 10.x.

lublak avatar Jan 21 '19 09:01 lublak