{"id":20699728,"url":"https://github.com/napi-rs/napi","last_synced_at":"2025-04-22T22:26:28.581Z","repository":{"id":66024535,"uuid":"106003977","full_name":"napi-rs/napi","owner":"napi-rs","description":"High-level Node.js N-API bindings for Rust ✨🦀🚀✨— ⚠️Deprecated in favor of https://github.com/napi-rs/napi-rs ⚠️","archived":false,"fork":false,"pushed_at":"2023-12-15T14:27:48.000Z","size":127,"stargazers_count":100,"open_issues_count":4,"forks_count":5,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-03-29T19:34:18.046Z","etag":null,"topics":["addons","n-api","napi","nodejs","rust","rust-bindings"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/napi-rs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-10-06T12:48:51.000Z","updated_at":"2024-10-30T21:15:02.000Z","dependencies_parsed_at":"2023-12-15T15:43:30.898Z","dependency_job_id":null,"html_url":"https://github.com/napi-rs/napi","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/napi-rs%2Fnapi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/napi-rs%2Fnapi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/napi-rs%2Fnapi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/napi-rs%2Fnapi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/napi-rs","download_url":"https://codeload.github.com/napi-rs/napi/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250333207,"owners_count":21413347,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["addons","n-api","napi","nodejs","rust","rust-bindings"],"created_at":"2024-11-17T00:31:41.338Z","updated_at":"2025-04-22T22:26:28.560Z","avatar_url":"https://github.com/napi-rs.png","language":"Rust","readme":"# Node.js N-API for Rust! [work in progress]\n\n[![Travis Build Status][travis-badge]][travis-url]\n[![AppVeyor Build Status][appveyor-badge]][appveyor-url]\n\nHigh-level N-API bindings for Node.js addons written in Rust.\n\n**Warning**: this is a proof-of-concept implementation that's not intended\nfor use yet. The project is under initial phase of development, the API is a\nquite sketchy and is going to be refactored heavily. If you are interested in\ncontributing, though, it is super welcome!\n\nThe project is covered by a [Code of Conduct][coc].\n\n## Crates\n\n* [`napi-sys`][napi-sys]: low-level bindings to N-API generated from\n  [`node_api.h`](https://github.com/nodejs/node/blob/master/src/node_api.h)\n  using [`bindgen`](https://github.com/rust-lang-nursery/rust-bindgen).\n* [`napi`][napi]: high-level and rusty wrappers around `napi-sys`.\n* [`napi-derive`][napi-derive]: contains a procedural macro that allows to\n  construct typesafe structures that represent N-API callback parameters and\n  automatically validate the arguments that JavaScript code passes in.\n\n## Example\n\nCheck out the [`example`][example] directory to see the full source code and\nproject structure of this example. (TODO: initialize the module from Rust too).\n\n### `lib.rs`\n\n```rust\n#[macro_use]\nextern crate napi;\n#[macro_use]\nextern crate napi_derive;\n\nuse napi::{NapiEnv, NapiNumber, NapiResult, NapiUndefined};\n\n#[derive(NapiArgs)]\nstruct HelloArgs;\n\nfn hello\u003c'a\u003e(env: \u0026'a NapiEnv, _: \u0026HelloArgs) -\u003e NapiResult\u003cNapiUndefined\u003c'a\u003e\u003e {\n    println!(\"Hello from the Rust land!\");\n    NapiUndefined::new(env)\n}\n\n#[derive(NapiArgs)]\nstruct AddArgs\u003c'a\u003e {\n    first: NapiNumber\u003c'a\u003e,\n    second: NapiNumber\u003c'a\u003e,\n}\n\nfn add\u003c'a\u003e(env: \u0026'a NapiEnv, args: \u0026AddArgs\u003c'a\u003e) -\u003e NapiResult\u003cNapiNumber\u003c'a\u003e\u003e {\n    let first = args.first.to_i32()?;\n    let second = args.second.to_i32()?;\n    NapiNumber::from_i32(env, first + second)\n}\n\nnapi_callback!(example_hello, hello);\nnapi_callback!(example_add, add);\n```\n\n### `example.js`\n\n```javascript\n'use strict';\n\nconst addon = require('./build/Release/example.node');\n\naddon.hello();\nconsole.log(addon.add(1, 2));\n```\n\n[appveyor-badge]: https://ci.appveyor.com/api/projects/status/9t6ckakvfmn07ru6/branch/master?svg=true\n[appveyor-url]: https://ci.appveyor.com/project/aqrln/napi-rs\n[coc]: https://github.com/napi-rs/napi/blob/master/CODE_OF_CONDUCT.md\n[example]: https://github.com/napi-rs/napi/tree/master/example\n[napi]: https://crates.io/crates/napi\n[napi-derive]: https://crates.io/crates/napi-derive\n[napi-sys]: https://crates.io/crates/napi-sys\n[travis-badge]: https://travis-ci.org/napi-rs/napi.svg?branch=master\n[travis-url]: https://travis-ci.org/napi-rs/napi\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnapi-rs%2Fnapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnapi-rs%2Fnapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnapi-rs%2Fnapi/lists"}