Re:Type conversions from JavaScript to C++ in V8
by megalodon on Sunday April 03, 2016 @02:22PM
(#11417025)
Somewhat related: You can also read and manipulate the contents of JavaScript typed arrays in V8:
[ Parent
| on HN ]
Re:Type conversions from JavaScript to C++ in V8
by dkopi on Sunday April 03, 2016 @03:00PM
(#11417165)
Be ultra careful when doing this.
First of all - make sure to get, validate and store the buffer's length (ByteLength())
Secondly - GetContents() is only for temporary access to a buffer. if you store that pointer and use it later (//do whatever), there's a great chance it will get garbage collected. Make sure to Externalize() the array if you intend on keeping the pointer for later.
Re:Type conversions from JavaScript to C++ in V8
by zbjornson on Sunday April 03, 2016 @07:24PM
(#11418332)
Or use the relatively new NaN helper TypedArrayContents:
https://github.com/nodejs/nan/blob/master/doc/v8_misc.md#api...