I want to port some C++ code to js using napi (node-addon-api). The code is a search handler that returns string. So I wanted to know if there is any size limit in napi in returning strings?
Asked
Active
Viewed 506 times
1 Answers
0
No obvious limit that I know of. But if you are going to pass really long strings, the copying from native to Javascript heap would kill the performance. You may consider use buffer-like types to pass the address of underlying data.
Refer to Using Buffers to share data between Node.js and C++ - Scott Frees for detail.
Related N-API: https://nodejs.org/api/n-api.html#n_api_napi_create_buffer

Lin Jian
- 66
- 3