Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: clarify behavior of napi_get_typedarray_info #32603

Closed
wants to merge 9 commits into from
8 changes: 6 additions & 2 deletions doc/api/n-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -2447,7 +2447,8 @@ napi_status napi_get_arraybuffer_info(napi_env env,

* `[in] env`: The environment that the API is invoked under.
* `[in] arraybuffer`: `napi_value` representing the `ArrayBuffer` being queried.
* `[out] data`: The underlying data buffer of the `ArrayBuffer`.
* `[out] data`: The underlying data buffer of the `ArrayBuffer`. If byte_length
is 0 this may be NULL or any other pointer value.
mhdawson marked this conversation as resolved.
Show resolved Hide resolved
* `[out] byte_length`: Length in bytes of the underlying data buffer.

Returns `napi_ok` if the API succeeded.
Expand Down Expand Up @@ -2479,6 +2480,7 @@ napi_status napi_get_buffer_info(napi_env env,
* `[in] env`: The environment that the API is invoked under.
* `[in] value`: `napi_value` representing the `node::Buffer` being queried.
* `[out] data`: The underlying data buffer of the `node::Buffer`.
If length is 0 this may be NULL or any other pointer value.
mhdawson marked this conversation as resolved.
Show resolved Hide resolved
* `[out] length`: Length in bytes of the underlying data buffer.

Returns `napi_ok` if the API succeeded.
Expand Down Expand Up @@ -2532,7 +2534,8 @@ napi_status napi_get_typedarray_info(napi_env env,
* `[out] length`: The number of elements in the `TypedArray`.
* `[out] data`: The data buffer underlying the `TypedArray` adjusted by
the `byte_offset` value so that it points to the first element in the
`TypedArray`.
`TypedArray`. If the length of the array is 0 this may be NULL or any
mhdawson marked this conversation as resolved.
Show resolved Hide resolved
other pointer value.
* `[out] arraybuffer`: The `ArrayBuffer` underlying the `TypedArray`.
* `[out] byte_offset`: The byte offset within the underlying native array
at which the first element of the arrays is located. The value for the data
Expand Down Expand Up @@ -2567,6 +2570,7 @@ napi_status napi_get_dataview_info(napi_env env,
properties to query.
* `[out] byte_length`: `Number` of bytes in the `DataView`.
* `[out] data`: The data buffer underlying the `DataView`.
If byte_length is 0 this may be NULL or any other pointer value.
mhdawson marked this conversation as resolved.
Show resolved Hide resolved
* `[out] arraybuffer`: `ArrayBuffer` underlying the `DataView`.
* `[out] byte_offset`: The byte offset within the data buffer from which
to start projecting the `DataView`.
Expand Down