Question
How do I distinguish the ArrayBuffer and Uint8Array objects created by ArkTS in native code?
Answer
- Use napi_is_arraybuffer to check whether the given object is an ArrayBuffer. If yes, true is returned.
- Use napi_is_typedarray to check whether the given object is a Uint8Array. If yes, true is returned.