napi_create_buffer
functionv1node_api.hThis API allocates a node::Buffer object. While this is still a fully-supported data structure, in most cases using a TypedArray will suffice.
napi_status napi_create_buffer(napi_env env,
size_t size,
void** data,
napi_value* result)
[in] env: The environment that the API is invoked under.[in] size: Size in bytes of the underlying buffer.[out] data: Raw pointer to the underlying buffer.datacan optionally be ignored by passingNULL.[out] result: Anapi_valuerepresenting anode::Buffer.
Returns napi_ok if the API succeeded.
This API allocates a node::Buffer object. While this is still a
fully-supported data structure, in most cases using a TypedArray will suffice.