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

Function CreateBuffer

test/buffer.cc:14–25  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12
13namespace {
14Value CreateBuffer(const CallbackInfo& info) {
15 Buffer<uint16_t> buffer = Buffer<uint16_t>::New(info.Env(), testLength);
16
17 if (buffer.Length() != testLength) {
18 Error::New(info.Env(), "Incorrect buffer length.")
19 .ThrowAsJavaScriptException();
20 return Value();
21 }
22
23 InitData(buffer.Data(), testLength);
24 return buffer;
25}
26
27Value CreateExternalBuffer(const CallbackInfo& info) {
28 finalizeCount = 0;

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected