示例工程 40-node-api-native-modules
40-node-api-native-modules/native/README.md
# hash_bridge(Rust / napi-rs)
最小 Node-API 原生模块:SHA-256、UTF-8 字节长度、模块版本。
使用 napi-rs 3.x 与 rustc 构建,产物为平台相关的 `.node`。
## 构建
```bash
./build.sh
# 等价于 cargo build --release && cp target/release/libhash_bridge.dylib ../app/native/hash_bridge.node
```
需要 Rust 工具链;没有 Rust 时应用会回退到纯 JS SHA-256。
## ABI
Node-API 的 ABI 与 Node 大版本解耦;本机实测同一个 `.node` 可被
Node 26.13.0(N-API 10)与 Electron 45.5.0 内置 Node 24.22.3(N-API 10)加载。
## 平台
当前预编译产物是 macOS arm64;其它平台请在本机重新构建,或使用 JS 回退。