This project is still in the early stages of development. All code, interfaces and features are unstable.
Inspired by napi-rs.
Experimental tool chain for build NodeJS modules with .NET 6.0 and C#.
napi-cs
will compile your modules into a native (architecture specific) shared library with Native AOT, modules can be safely distributed without .NET installation.
- Pre-requisites
- The latest version of .NET 6.0.
- c++ toolchain in your system, see more detail here Pre-requisites for Native AOT
- Install Templates
$ dotnet new -i NApi.Template
- Create Project
$ mkdir foo && cd foo
$ dotnet new nodejs
- Build
$ dotnet build
- Test Your Module
$ node
> require("./bin/Debug/net6.0/osx-x64/publish/module.node")
PS: Replace
osx-x64
with your operating system
- Only support x64 Windows, Linux, MacOS.
- Limitations of Native AOT Runtime
[TODO] CoreCLR Mode: No above limitations, but it depends on .NET installation at runtime