> For the complete documentation index, see [llms.txt](https://nongchatea.gitbook.io/koffi-chinese/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://nongchatea.gitbook.io/koffi-chinese/koffi.md).

# KOFFI

<figure><img src="/files/LB6uCAgqtt4BVW7mcoEM" alt=""><figcaption><p>koffi</p></figcaption></figure>

## 概述

Koffi 是一个**快速且易于使用的 Node.js C FFI 模块**，具有以下特点：

* 低开销和快速性能（参见[基准测试](https://koffi.dev/benchmarks#benchmarks)）
* 通过引用（指针）和值支持原始和聚合数据类型（结构和固定大小数组）
* Javascript 函数可以用作 C 回调（自 1.2.0 起）
* [针对流行操作系统/架构组合](/koffi-chinese/an-zhuang-xu-qiu.md#zhi-chi-de-ping-tai)的经过良好测试的代码库

Koffi 需要具有 N-API 版本 8 支持的最新[Node.js版本，请参阅](https://nodejs.org/)[此页面](https://koffi.dev/platforms#node-js)了解更多信息。

源代码可在此处获取：<https://github.com/Koromix/rygel/> （在*src/koffi*子目录中）。

新版本频繁发布，请查看[变更日志](https://koffi.dev/changelog#changelog)以获取更多信息。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://nongchatea.gitbook.io/koffi-chinese/koffi.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
