I have an array of bytes defined as
unsigned char ptr = new unsigned char[1024];
fillWithSomething(ptr, 1024);
Then, I need to store the ptr
variable in a Local< Array>
variable of V8 Engine or another kind of V8 data type.
Currently, I am converting the array of bytes into a string in order to store in a Local< String>
variable, but this approach is inefficient to my application.
Thanks in advance.
UPDATED (thanks to Vyacheslav Egorov)
I test the solution with an external array but I can't use it on my node.js server code. I have the following code (on my extension side C++):
Handle<Object> array = Object::New();
array->SetIndexedPropertiesToExternalArrayData(getBytes(), kExternalUnsignedByteArray, bytesSize);
return array;
My question is, How I can use the array
variable in my server code (javascript) to call the function GetIndexedPropertiesExternalArrayData()
.
Thanks again