I have a native NodeJS addon that accepts a Buffer
instance as one of it\'s arguments.
I\'m able to convert a char
array into a Buffer
Maybe I'm late, but the following code should work:
#include <node.h>
#include <node_buffer.h>
void Test(const FunctionCallbackInfo<Value>& args)
{
Local<Object> bufferObj = args[0]->ToObject();
char* bufferData = node::Buffer::Data(bufferObj);
size_t bufferLength = node::Buffer::Length(bufferObj);
}
Reference: