napi-rs Docs

NAPI-RS is a minimal library for building pre-compiled NodeJS addons in Rust.

npm Downloads Github stars
lib.rs
#[js_function(1)]
fn fibonacci(ctx: CallContext) -> Result<JsNumber> {
let n = ctx.get::<JsNumber>(0)?.try_into()?;
ctx.env.create_int64(fibonacci_native(n))
}
index.js
function hello() {
let result = fibonacci(10000)
console.log(result)
return result
}

Features

🚀 Bring native performance for NodeJS

👷‍♂️ Memory safe, guaranteed by Rust compiler

⚡️ Zero copy data interactive between Rust & NodeJS

⚙️ Parallelism in few lines

Well tested

Lint Linux N-API@3 Linux musl macOS/Windows/Linux x64 Linux-aarch64 Windows i686 FreeBSD

Support matrix

NodeJS

Node10Node12Node14Node15

Platform support

✅ Means official tested in napi-rs repo.
- Means no official NodeJS release.

i686x64aarch64arm
Windows--
macOS--
Linux-
Linux musl---
FreeBSD---
Android---