Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/elmarx/nodejs-sys

Native bindings to NodeJS' N-API
https://github.com/elmarx/nodejs-sys

Last synced: 5 days ago
JSON representation

Native bindings to NodeJS' N-API

Awesome Lists containing this project

README

        

[![Rust build](https://github.com/elmarx/nodejs-sys/workflows/Rust/badge.svg)](https://github.com/elmarx/nodejs-sys/actions?query=workflow%3ARust) [![crates.io badge](https://img.shields.io/crates/v/nodejs-sys.svg)](https://crates.io/crates/nodejs-sys) [![docs.rs badge](https://docs.rs/nodejs-sys/badge.svg)](https://docs.rs/nodejs-sys)

nodejs-sys
----------

Bindings for NodeJS' [N-API](https://nodejs.org/dist/latest-v14.x/docs/api/n-api.html).

Requirements
============

This crate needs `llvm` at build-time, since it generates bindings at build-time (by using [bindgen](https://docs.rs/bindgen/)).

For Debian/Ubuntu that's a simple `apt install llvm libclang-dev`.

Features
========

Different API versions may be selected via feature-flag. See the [N-API Version Matrix](https://nodejs.org/dist/latest-v14.x/docs/api/n-api.html#n_api_n_api_version_matrix) for details.

- `napi_v5` supported by all [actively maintained](https://nodejs.org/en/about/releases/) NodeJS releases
- `napi_v6` supported by all [actively maintained](https://nodejs.org/en/about/releases/) NodeJS releases
- `napi_v7` supported by all [actively maintained](https://nodejs.org/en/about/releases/) NodeJS releases
- `napi_v8` requires at least `15.12.0`, this is the **default** (if no flag is given)
- the experimental N-API features may be enabled via feature flag `experimental` (*off* by default)

Updates
=======

Not all NodeJS Versions change the N-API, so `nodejs-sys` gets an update only if the relevant headers have been changed between node versions.

See the (autogenerated) changelog for links to detailed upstream commits.

Usage
=====

This crate is very low-level. See [neon](https://neon-bindings.com/), they provide [N-API Support](https://github.com/neon-bindings/neon/issues/444).

But of course you may also use this crate directly, [LogRocket](https://logrocket.com/) has a nice blog post:
[Rust and Node.js: A match made in heaven](https://blog.logrocket.com/rust-and-node-js-a-match-made-in-heaven/).