Skip to content

Commit 1612632

Browse files
mhdawsontargos
authored andcommitted
doc: clarify behavior of napi_get_typedarray_info
Signed-off-by: Michael Dawson <michael_dawson@ca.ibm.com> Fixes: #32089 PR-URL: #32603 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
1 parent bc9453a commit 1612632

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

doc/api/n-api.md

+6-2
Original file line numberDiff line numberDiff line change
@@ -2391,7 +2391,8 @@ napi_status napi_get_arraybuffer_info(napi_env env,
23912391

23922392
* `[in] env`: The environment that the API is invoked under.
23932393
* `[in] arraybuffer`: `napi_value` representing the `ArrayBuffer` being queried.
2394-
* `[out] data`: The underlying data buffer of the `ArrayBuffer`.
2394+
* `[out] data`: The underlying data buffer of the `ArrayBuffer`. If byte_length
2395+
is `0`, this may be `NULL` or any other pointer value.
23952396
* `[out] byte_length`: Length in bytes of the underlying data buffer.
23962397

23972398
Returns `napi_ok` if the API succeeded.
@@ -2423,6 +2424,7 @@ napi_status napi_get_buffer_info(napi_env env,
24232424
* `[in] env`: The environment that the API is invoked under.
24242425
* `[in] value`: `napi_value` representing the `node::Buffer` being queried.
24252426
* `[out] data`: The underlying data buffer of the `node::Buffer`.
2427+
If length is `0`, this may be `NULL` or any other pointer value.
24262428
* `[out] length`: Length in bytes of the underlying data buffer.
24272429

24282430
Returns `napi_ok` if the API succeeded.
@@ -2476,7 +2478,8 @@ napi_status napi_get_typedarray_info(napi_env env,
24762478
* `[out] length`: The number of elements in the `TypedArray`.
24772479
* `[out] data`: The data buffer underlying the `TypedArray` adjusted by
24782480
the `byte_offset` value so that it points to the first element in the
2479-
`TypedArray`.
2481+
`TypedArray`. If the length of the array is `0`, this may be `NULL` or
2482+
any other pointer value.
24802483
* `[out] arraybuffer`: The `ArrayBuffer` underlying the `TypedArray`.
24812484
* `[out] byte_offset`: The byte offset within the underlying native array
24822485
at which the first element of the arrays is located. The value for the data
@@ -2511,6 +2514,7 @@ napi_status napi_get_dataview_info(napi_env env,
25112514
properties to query.
25122515
* `[out] byte_length`: `Number` of bytes in the `DataView`.
25132516
* `[out] data`: The data buffer underlying the `DataView`.
2517+
If byte_length is `0`, this may be `NULL` or any other pointer value.
25142518
* `[out] arraybuffer`: `ArrayBuffer` underlying the `DataView`.
25152519
* `[out] byte_offset`: The byte offset within the data buffer from which
25162520
to start projecting the `DataView`.

0 commit comments

Comments
 (0)