11# ArrayBuffer
22
3- The ` ArrayBuffer ` class corresponds to the JavaScript ` ArrayBuffer ` class.
3+ The ` ArrayBuffer ` class corresponds to the
4+ [ JavaScript ` ArrayBuffer ` ] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer )
5+ class.
46
57## Methods
68
79### New
810
9- Allocates a new ` ArrayBuffer ` object with a given length.
11+ Allocates a new ` ArrayBuffer ` instance with a given length.
1012
1113``` cpp
1214static ArrayBuffer New (napi_env env, size_t byteLength);
1315```
1416
15- - `[in] env`: The environment in which to create the ArrayBuffer object .
17+ - `[in] env`: The environment in which to create the ` ArrayBuffer` instance .
1618- `[in] byteLength`: The length to be allocated, in bytes.
1719
18- Returns a new `ArrayBuffer` object .
20+ Returns a new `ArrayBuffer` instance .
1921
2022### New
2123
22- Wraps the provided external data into a new `ArrayBuffer` object .
24+ Wraps the provided external data into a new `ArrayBuffer` instance .
2325
24- The `ArrayBuffer` object does not assume ownership for the data and expects it
25- to be valid for the lifetime of the object . Since the `ArrayBuffer` is subject
26+ The `ArrayBuffer` instance does not assume ownership for the data and expects it
27+ to be valid for the lifetime of the instance . Since the `ArrayBuffer` is subject
2628to garbage collection this overload is only suitable for data which is static
2729and never needs to be freed.
2830
2931```cpp
3032static ArrayBuffer New(napi_env env, void* externalData, size_t byteLength);
3133```
3234
33- - ` [in] env ` : The environment in which to create the ` ArrayBuffer ` object .
35+ - ` [in] env ` : The environment in which to create the ` ArrayBuffer ` instance .
3436- ` [in] externalData ` : The pointer to the external data to wrap.
3537- ` [in] byteLength ` : The length of the ` externalData ` , in bytes.
3638
37- Returns a new ` ArrayBuffer ` object .
39+ Returns a new ` ArrayBuffer ` instance .
3840
3941### New
4042
41- Wraps the provided external data into a new ` ArrayBuffer ` object .
43+ Wraps the provided external data into a new ` ArrayBuffer ` instance .
4244
43- The ` ArrayBuffer ` object does not assume ownership for the data and expects it
44- to be valid for the lifetime of the object . The data can only be freed once the
45- ` finalizeCallback ` is invoked to indicate that the ` ArrayBuffer ` has been
45+ The ` ArrayBuffer ` instance does not assume ownership for the data and expects it
46+ to be valid for the lifetime of the instance . The data can only be freed once
47+ the ` finalizeCallback ` is invoked to indicate that the ` ArrayBuffer ` has been
4648released.
4749
4850``` cpp
@@ -53,22 +55,22 @@ static ArrayBuffer New(napi_env env,
5355 Finalizer finalizeCallback);
5456```
5557
56- - `[in] env`: The environment in which to create the `ArrayBuffer` object .
58+ - `[in] env`: The environment in which to create the `ArrayBuffer` instance .
5759- `[in] externalData`: The pointer to the external data to wrap.
5860- `[in] byteLength`: The length of the `externalData`, in bytes.
5961- `[in] finalizeCallback`: A function to be called when the `ArrayBuffer` is
6062 destroyed. It must implement `operator()`, accept a `void*` (which is the
6163 `externalData` pointer), and return `void`.
6264
63- Returns a new `ArrayBuffer` object .
65+ Returns a new `ArrayBuffer` instance .
6466
6567### New
6668
67- Wraps the provided external data into a new `ArrayBuffer` object .
69+ Wraps the provided external data into a new `ArrayBuffer` instance .
6870
69- The `ArrayBuffer` object does not assume ownership for the data and expects it
70- to be valid for the lifetime of the object . The data can only be freed once the
71- `finalizeCallback` is invoked to indicate that the `ArrayBuffer` has been
71+ The `ArrayBuffer` instance does not assume ownership for the data and expects it
72+ to be valid for the lifetime of the instance . The data can only be freed once
73+ the `finalizeCallback` is invoked to indicate that the `ArrayBuffer` has been
7274released.
7375
7476```cpp
@@ -80,7 +82,7 @@ static ArrayBuffer New(napi_env env,
8082 Hint* finalizeHint);
8183```
8284
83- - ` [in] env ` : The environment in which to create the ` ArrayBuffer ` object .
85+ - ` [in] env ` : The environment in which to create the ` ArrayBuffer ` instance .
8486- ` [in] externalData ` : The pointer to the external data to wrap.
8587- ` [in] byteLength ` : The length of the ` externalData ` , in bytes.
8688- ` [in] finalizeCallback ` : The function to be called when the ` ArrayBuffer ` is
@@ -89,7 +91,7 @@ static ArrayBuffer New(napi_env env,
8991- ` [in] finalizeHint ` : The hint to be passed as the second parameter of the
9092 finalize callback.
9193
92- Returns a new ` ArrayBuffer ` object .
94+ Returns a new ` ArrayBuffer ` instance .
9395
9496### Constructor
9597
@@ -107,7 +109,7 @@ Initializes a wrapper instance of an existing `ArrayBuffer` object.
107109ArrayBuffer (napi_env env, napi_value value);
108110```
109111
110- - `[in] env`: The environment in which to create the `ArrayBuffer` object .
112+ - `[in] env`: The environment in which to create the `ArrayBuffer` instance .
111113- `[in] value`: The `ArrayBuffer` reference to wrap.
112114
113115### ByteLength
0 commit comments