vectrixdevelops / audio-mpg123

A native node binding to write raw PCM data to an OS driver.
MIT License
5 stars 0 forks source link

N-API #9

Closed jamen closed 4 years ago

jamen commented 7 years ago

Node 8 just released N-API. This is basically like a built-in nan. Probably with tons of improvements too.

It might nit be worth looking to now (I am unsure about backwards compatibility), but it is worth discussing for the future.

jamen commented 7 years ago

So after reading a bit into it, it seems backwards compatibility will not be a concern.

What is interesting is that they list various N-API enabled modules which they are using for testing to some degree. It would be awesome to get involved in this early and possibly get a spot in that list.

However, this does mean we will have to abandon or finish the api-refactor branch before we can move forward, since the N-APIs are completely different from nan. We can still move forward on #5 and #8 too.

I'm interested in taking this forward if the rest of you are! The worst scenario I can see is the package breaking on Node.js versions post-LTS, which is not the end of the world, and if their testing has been good (which I imagine so) then I don't think it should be a problem.

vectrixdevelops commented 7 years ago

There isn't really anything advantageous over in the api-refactor branch that would work with changing to N-API. I think I will start a new branch that will implement N-API. I think it will be very cool to try it out and see how it goes. If it works well, we can look at merging the idea into master.

vectrixdevelops commented 7 years ago

@jamen has just pointed out to me that N-API has support for ArrayBuffers very nicely, so that will be super handy.

jamen commented 7 years ago

https://nodejs.org/api/n-api.html#n_api_napi_is_arraybuffer https://nodejs.org/api/n-api.html#n_api_napi_get_arraybuffer_info