summaryrefslogtreecommitdiff
path: root/doc/api/n-api.md
diff options
context:
space:
mode:
authorMichael Dawson <michael_dawson@ca.ibm.com>2018-05-15 10:57:30 -0400
committerMichael Dawson <michael_dawson@ca.ibm.com>2018-05-28 13:40:11 -0400
commit35cf00842f65077bce64cc25d39b72477afa161e (patch)
tree9b7400c0df2ff8cfff208a1d82d1064c2ef9f245 /doc/api/n-api.md
parent5624a6f8a77b8215b25e7ca27d4ac4ed66f72aee (diff)
downloadandroid-node-v8-35cf00842f65077bce64cc25d39b72477afa161e.tar.gz
android-node-v8-35cf00842f65077bce64cc25d39b72477afa161e.tar.bz2
android-node-v8-35cf00842f65077bce64cc25d39b72477afa161e.zip
doc: fix doc for napi_get_typedarray_info
The data pointer returned for the typedarray has already been adjusted by the offset so it does not point to the start of the buffer, instead id points to the start of the first element. I think we probably would have liked it to point to the start of the buffer, but we can't change as that would be a breaking change. Update the doc to match the implementation. PR-URL: https://github.com/nodejs/node/pull/20747 Fixes: https://github.com/nodejs/node-addon-api/issues/244 Reviewed-By: Gabriel Schulhof <gabriel.schulhof@intel.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'doc/api/n-api.md')
-rw-r--r--doc/api/n-api.md11
1 files changed, 8 insertions, 3 deletions
diff --git a/doc/api/n-api.md b/doc/api/n-api.md
index a8d1ae46d0..5a98b93d1f 100644
--- a/doc/api/n-api.md
+++ b/doc/api/n-api.md
@@ -1750,10 +1750,15 @@ napi_status napi_get_typedarray_info(napi_env env,
properties to query.
- `[out] type`: Scalar datatype of the elements within the `TypedArray`.
- `[out] length`: The number of elements in the `TypedArray`.
-- `[out] data`: The data buffer underlying 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`.
- `[out] arraybuffer`: The `ArrayBuffer` underlying the `TypedArray`.
-- `[out] byte_offset`: The byte offset within the data buffer from which
-to start projecting 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
+parameter has already been adjusted so that data points to the first element
+in the array. Therefore, the first byte of the native array would be at
+data - `byte_offset`.
Returns `napi_ok` if the API succeeded.