> ## Documentation Index
> Fetch the complete documentation index at: https://bun.zhcndoc.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Node-API

> 使用 Bun 的 Node-API 模块构建 Node.js 的原生插件

Node-API 是一个用于构建 Node.js 原生插件的接口。Bun 从零实现了该接口的 95%，因此大多数现有的 Node-API 扩展可以直接在 Bun 上运行。可以在[此 issue](https://github.com/oven-sh/bun/issues/158)追踪其完成状态。

与 Node.js 中相同，`.node` 文件（Node-API 模块）可以直接在 Bun 中通过 require 加载。

```js theme={"theme":{"light":"github-light","dark":"dracula"}}
const napi = require("./my-node-module.node");
```

或者，使用 `process.dlopen`：

```js theme={"theme":{"light":"github-light","dark":"dracula"}}
let mod = { exports: {} };
process.dlopen(mod, "./my-node-module.node");
```
