napi_create_dataview
functionv1js_native_api.hThis API creates a JavaScript DataView object over an existing ArrayBuffer or SharedArrayBuffer.
napi_status napi_create_dataview(napi_env env,
size_t byte_length,
napi_value arraybuffer,
size_t byte_offset,
napi_value* result)
[in] env: The environment that the API is invoked under.[in] length: Number of elements in theDataView.[in] arraybuffer:ArrayBufferorSharedArrayBufferunderlying theDataView.[in] byte_offset: The byte offset within theArrayBufferfrom which to start projecting theDataView.[out] result: Anapi_valuerepresenting a JavaScriptDataView.
Returns napi_ok if the API succeeded.
This API creates a JavaScript DataView object over an existing ArrayBuffer
or SharedArrayBuffer. DataView objects provide an array-like view over an
underlying data buffer, but one which allows items of different size and type in
the ArrayBuffer or SharedArrayBuffer.
It is required that byte_length + byte_offset is less than or equal to the
size in bytes of the array passed in. If not, a RangeError exception is
raised.
JavaScript DataView objects are described in
Section DataView objects of the ECMAScript Language Specification.