node_api_create_buffer_from_arraybuffer
functionv10node_api.hThis API creates a JavaScript Buffer object from an existing ArrayBuffer. The Buffer object is a Node.js-specific class that provides a way to work with binary data directly in JavaScript.
napi_status NAPI_CDECL node_api_create_buffer_from_arraybuffer(napi_env env,
napi_value arraybuffer,
size_t byte_offset,
size_t byte_length,
napi_value* result)
[in] env: The environment that the API is invoked under.[in] arraybuffer: TheArrayBufferfrom which the buffer will be created.[in] byte_offset: The byte offset within theArrayBufferfrom which to start creating the buffer.[in] byte_length: The length in bytes of the buffer to be created from theArrayBuffer.[out] result: Anapi_valuerepresenting the created JavaScriptBufferobject.
Returns napi_ok if the API succeeded.
This API creates a JavaScript Buffer object from an existing ArrayBuffer.
The Buffer object is a Node.js-specific class that provides a way to work with binary data directly in JavaScript.
The byte range [byte_offset, byte_offset + byte_length)
must be within the bounds of the ArrayBuffer. If byte_offset + byte_length
exceeds the size of the ArrayBuffer, a RangeError exception is raised.