MCPcopy Index your code
hub / github.com/nodejs/node-addon-api / CreateBufferWithConstructor

Function CreateBufferWithConstructor

test/array_buffer.cc:145–155  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

143}
144
145Value CreateBufferWithConstructor(const CallbackInfo& info) {
146 ArrayBuffer buffer = ArrayBuffer::New(info.Env(), testLength);
147 if (buffer.ByteLength() != testLength) {
148 Error::New(info.Env(), "Incorrect buffer length.")
149 .ThrowAsJavaScriptException();
150 return Value();
151 }
152 InitData(static_cast<uint8_t*>(buffer.Data()), testLength);
153 ArrayBuffer buffer2(info.Env(), buffer);
154 return buffer2;
155}
156
157Value CheckEmptyBuffer(const CallbackInfo& info) {
158 ArrayBuffer buffer;

Callers

nothing calls this directly

Calls 6

EnvMethod · 0.80
ByteLengthMethod · 0.80
DataMethod · 0.80
InitDataFunction · 0.70
ValueClass · 0.50

Tested by

no test coverage detected