summaryrefslogtreecommitdiff
path: root/src/util.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/util.cc')
-rw-r--r--src/util.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/util.cc b/src/util.cc
index 3cdc222a96..223e0e8772 100644
--- a/src/util.cc
+++ b/src/util.cc
@@ -29,6 +29,7 @@
namespace node {
+using v8::ArrayBufferView;
using v8::Isolate;
using v8::Local;
using v8::String;
@@ -89,11 +90,11 @@ BufferValue::BufferValue(Isolate* isolate, Local<Value> value) {
if (value->IsString()) {
MakeUtf8String(isolate, value, this);
- } else if (Buffer::HasInstance(value)) {
- const size_t len = Buffer::Length(value);
+ } else if (value->IsArrayBufferView()) {
+ const size_t len = value.As<ArrayBufferView>()->ByteLength();
// Leave place for the terminating '\0' byte.
AllocateSufficientStorage(len + 1);
- memcpy(out(), Buffer::Data(value), len);
+ value.As<ArrayBufferView>()->CopyContents(out(), len);
SetLengthAndZeroTerminate(len);
} else {
Invalidate();