Skip to content

Commit 19deaa5

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 0087eb1 commit 19deaa5

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
@@ -2447,7 +2447,8 @@ napi_status napi_get_arraybuffer_info(napi_env env,
24472447

24482448
* `[in] env`: The environment that the API is invoked under.
24492449
* `[in] arraybuffer`: `napi_value` representing the `ArrayBuffer` being queried.
2450-
* `[out] data`: The underlying data buffer of the `ArrayBuffer`.
2450+
* `[out] data`: The underlying data buffer of the `ArrayBuffer`. If byte_length
2451+
is `0`, this may be `NULL` or any other pointer value.
24512452
* `[out] byte_length`: Length in bytes of the underlying data buffer.
24522453

24532454
Returns `napi_ok` if the API succeeded.
@@ -2479,6 +2480,7 @@ napi_status napi_get_buffer_info(napi_env env,
24792480
* `[in] env`: The environment that the API is invoked under.
24802481
* `[in] value`: `napi_value` representing the `node::Buffer` being queried.
24812482
* `[out] data`: The underlying data buffer of the `node::Buffer`.
2483+
If length is `0`, this may be `NULL` or any other pointer value.
24822484
* `[out] length`: Length in bytes of the underlying data buffer.
24832485

24842486
Returns `napi_ok` if the API succeeded.
@@ -2532,7 +2534,8 @@ napi_status napi_get_typedarray_info(napi_env env,
25322534
* `[out] length`: The number of elements in the `TypedArray`.
25332535
* `[out] data`: The data buffer underlying the `TypedArray` adjusted by
25342536
the `byte_offset` value so that it points to the first element in the
2535-
`TypedArray`.
2537+
`TypedArray`. If the length of the array is `0`, this may be `NULL` or
2538+
any other pointer value.
25362539
* `[out] arraybuffer`: The `ArrayBuffer` underlying the `TypedArray`.
25372540
* `[out] byte_offset`: The byte offset within the underlying native array
25382541
at which the first element of the arrays is located. The value for the data
@@ -2567,6 +2570,7 @@ napi_status napi_get_dataview_info(napi_env env,
25672570
properties to query.
25682571
* `[out] byte_length`: `Number` of bytes in the `DataView`.
25692572
* `[out] data`: The data buffer underlying the `DataView`.
2573+
If byte_length is `0`, this may be `NULL` or any other pointer value.
25702574
* `[out] arraybuffer`: `ArrayBuffer` underlying the `DataView`.
25712575
* `[out] byte_offset`: The byte offset within the data buffer from which
25722576
to start projecting the `DataView`.

0 commit comments

Comments
 (0)