Bump node-addon-api for Buffer::NewOrCopy

This commit is contained in:
Lovell Fuller
2023-04-23 15:43:54 +01:00
parent 90abd927c9
commit e98993a6e2
5 changed files with 9 additions and 19 deletions

View File

@@ -65,16 +65,6 @@ namespace sharp {
}
return vector;
}
Napi::Buffer<char> NewOrCopyBuffer(Napi::Env env, char* data, size_t len) {
try {
return Napi::Buffer<char>::New(env, data, len, FreeCallback);
} catch (Napi::Error const &err) {
static_cast<void>(err);
}
Napi::Buffer<char> buf = Napi::Buffer<char>::Copy(env, data, len);
FreeCallback(nullptr, data);
return buf;
}
// Create an InputDescriptor instance from a Napi::Object describing an input image
InputDescriptor* CreateInputDescriptor(Napi::Object input) {