Skip to content

Commit cf495a6

Browse files
mhdawsontargos
authored andcommitted
doc: clarify more optional parameters in node-api
Refs: nodejs/abi-stable-node#252 Signed-off-by: Michael Dawson <[email protected]> PR-URL: #40888 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Tobias Nießen <[email protected]>
1 parent 3d593aa commit cf495a6

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

doc/api/n-api.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -2216,6 +2216,7 @@ napi_status napi_create_arraybuffer(napi_env env,
22162216
* `[in] env`: The environment that the API is invoked under.
22172217
* `[in] length`: The length in bytes of the array buffer to create.
22182218
* `[out] data`: Pointer to the underlying byte buffer of the `ArrayBuffer`.
2219+
`data` can optionally be ignored by passing `NULL`.
22192220
* `[out] result`: A `napi_value` representing a JavaScript `ArrayBuffer`.
22202221
22212222
Returns `napi_ok` if the API succeeded.
@@ -2250,6 +2251,7 @@ napi_status napi_create_buffer(napi_env env,
22502251
* `[in] env`: The environment that the API is invoked under.
22512252
* `[in] size`: Size in bytes of the underlying buffer.
22522253
* `[out] data`: Raw pointer to the underlying buffer.
2254+
`data` can optionally be ignored by passing `NULL`.
22532255
* `[out] result`: A `napi_value` representing a `node::Buffer`.
22542256
22552257
Returns `napi_ok` if the API succeeded.
@@ -2277,6 +2279,7 @@ napi_status napi_create_buffer_copy(napi_env env,
22772279
of the new buffer).
22782280
* `[in] data`: Raw pointer to the underlying buffer to copy from.
22792281
* `[out] result_data`: Pointer to the new `Buffer`'s underlying data buffer.
2282+
`result_data` can optionally be ignored by passing `NULL`.
22802283
* `[out] result`: A `napi_value` representing a `node::Buffer`.
22812284
22822285
Returns `napi_ok` if the API succeeded.
@@ -4588,8 +4591,8 @@ napi_status napi_create_function(napi_env env,
45884591
```
45894592
45904593
* `[in] env`: The environment that the API is invoked under.
4591-
* `[in] utf8Name`: The name of the function encoded as UTF8. This is visible
4592-
within JavaScript as the new function object's `name` property.
4594+
* `[in] utf8Name`: Optional name of the function encoded as UTF8. This is
4595+
visible within JavaScript as the new function object's `name` property.
45934596
* `[in] length`: The length of the `utf8name` in bytes, or `NAPI_AUTO_LENGTH` if
45944597
it is null-terminated.
45954598
* `[in] cb`: The native function which should be called when this function

0 commit comments

Comments
 (0)