Using node::Buffer::Copy() instead of node::Buffer::New() to copy the handle bytes to buffer make the buffer really contains the data.
This commit is contained in:
parent
18631df88b
commit
702455674b
1 changed files with 1 additions and 1 deletions
|
@ -109,7 +109,7 @@ void TranslateOldOptions(v8::Isolate* isolate, v8::Local<v8::Object> options) {
|
|||
|
||||
// Converts binary data to Buffer.
|
||||
v8::Local<v8::Value> ToBuffer(v8::Isolate* isolate, void* val, int size) {
|
||||
auto buffer = node::Buffer::New(isolate, static_cast<char*>(val), size);
|
||||
auto buffer = node::Buffer::Copy(isolate, static_cast<char*>(val), size);
|
||||
if (buffer.IsEmpty())
|
||||
return v8::Null(isolate);
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue