Skip to content

doc: clarify use of Uint8Array for n-api

napi_get_buffer_info always supported receiving Uint8Array as a value argument because node::Buffer is a subclass of Uint8Array and the underlying V8 APIs don't distinguish between two. With this change we mark both types as supported by the API so that the user code doesn't have to unknowingly use oficially unsupported type of the value argument.


Hello!

I think it'd be great to officially mark Uint8Arrays as supported since it is very likely that there is existing code in the wild that relies on this. The N-API never distinguished between node::Buffer and Uint8Array so it'd be a breaking change if we started to bail on Uint8Array anyway. Let's mark it as supported now to signify existing code as compliant to official APIs!

Merge request reports

Loading