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

Function CreateBuffer

test/array_buffer.cc:26–37  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24}
25
26Value CreateBuffer(const CallbackInfo& info) {
27 ArrayBuffer buffer = ArrayBuffer::New(info.Env(), testLength);
28
29 if (buffer.ByteLength() != testLength) {
30 Error::New(info.Env(), "Incorrect buffer length.")
31 .ThrowAsJavaScriptException();
32 return Value();
33 }
34
35 InitData(static_cast<uint8_t*>(buffer.Data()), testLength);
36 return buffer;
37}
38
39Value CreateExternalBuffer(const CallbackInfo& info) {
40 finalizeCount = 0;

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