作者:永不放弃2702935973 | 来源:互联网 | 2023-05-24 19:06
1> 小智..:
也许我迟到了,但下面的代码应该有效:
#include
#include
void Test(const FunctionCallbackInfo& args)
{
Local bufferObj = args[0]->ToObject();
char* bufferData = node::Buffer::Data(bufferObj);
size_t bufferLength = node::Buffer::Length(bufferObj);
}
参考:
http://www.puritys.me/docs-blog/article-286-How-to-pass-the-paramater-of-Node.js-or-io.js-into-native-C/C++-function. html的
https://github.com/nodejs/nan/blob/master/nan.h#L25