Skip to content

Latest commit

 

History

History
99 lines (70 loc) · 2.15 KB

index.en.mdx

File metadata and controls

99 lines (70 loc) · 2.15 KB
title description
Home
NAPI-RS is a framework for building Node.js addons in Rust.

import { Badges } from '../components/badges' import { Rust } from '../components/chalk' import { Ecosystem } from '../components/ecosystem' import { Sponsors } from '../components/sponsors' import { TitleEN } from '../components/title.en'

export const getStaticProps = async () => { const sponsorsSVG = await fetch(https://sponsors.napi.rs/sponsors.svg).then( (res) => res.text(), ) return { props: { ssg: sponsorsSVG, }, } }

Rustify Node.js in few lines!

use napi_derive::napi;

#[napi]
fn fibonacci(n: u32) -> u32 {
  match n {
    1 | 2 => 1,
    _ => fibonacci(n - 1) + fibonacci(n - 2),
  }
}

Compatible with both CommonJS and esm, with auto generated .d.ts file:

import { fibonacci } from './index.js'

// output: 5
console.log(fibonacci(5))
const { fibonacci } = require('./index')

// output: 5
console.log(fibonacci(5))

Features

🚀 Bring native performance for Node.js

👷‍♂️ Memory safe, guaranteed by Rust compiler

⚡️ Zero copy data interactive between Rust & Node.js via Buffer and TypedArray

⚙️ Parallelism in few lines

Sponsors

Ecosystem

Support matrix

Node.js

Node10 Node12 Node14 Node16 Node18 Node20

Platform support

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

i686 x64 aarch64 arm
Windows -
macOS -
Linux -
Linux musl - -
FreeBSD - - -
Android - -

Related projects