# @f5-sales-demo/pi-natives 中文文档

规范地址：https://npmcn.com/package/%40f5-sales-demo/pi-natives/

版本：23\.10\.13
npm 元数据更新时间：2026-11-13T03:56:59.406Z
中文译文更新时间：2026-11-14T07:33:16.824Z
软件包许可：MIT

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40f5-sales-demo/pi-natives
原文对照：https://npmcn.com/package/%40f5-sales-demo/pi-natives/?lang=original
项目主页：https://github.com/f5-sales-demo/xcsh
源码仓库：https://github.com/f5-sales-demo/xcsh

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：68.5 kB，9 个文件
- 模块格式：ESM + CJS
- TypeScript 类型：包内自带
- 运行依赖：0 个
- 首次发布：2026-06-26T15:15:23.561Z
- 最新版本发布：2026-11-13T03:56:59.021Z
- 近 30 天下载量：8991（2026-10-14 至 2026-11-12，npm 官方下载统计）
- 已发布版本数：450（近 12 个月 450 个）

## 中文简介

用于grep、剪贴板、图像处理、语法突出显示、PTY和通过N-API的 shell 操作的原生 Rust 绑定

## 安装

```sh
npm install @f5-sales-demo/pi-natives
```

也可以使用：`pnpm add @f5-sales-demo/pi-natives`、`yarn add @f5-sales-demo/pi-natives`、`bun add @f5-sales-demo/pi-natives`

## README

# @f5-sales-demo/pi-natives (英语)

通过 N-API 的原始 Rust 功能 .

## 里面的东西

-   **Grep 读取**: 基于 Regex 的搜索由 riggrep 的引擎提供动力, 并配对本地文件
-   **查找**: 基于 gitignore 支持的基于 glob 的文件/目录发现(纯类型脚本通过 `globPaths`(中文(简体) )
-   **图像**: 通过光子-rs(大小调整,格式转换)通过N-API曝光的图像处理

## 使用量

```typescript
import { grep, find } from "@f5-sales-demo/pi-natives";

// Grep for a pattern
const results = await grep({
 pattern: "TODO",
 path: "/path/to/project",
 glob: "*.ts",
 context: 2,
});

// Find files
const files = await find({
 pattern: "*.rs",
 path: "/path/to/project",
 fileType: "file",
});

// Image processing
const pngBytes = await new Bun.Image(bytes).resize(800, 600).png().bytes();
```

## 大楼

```bash
# Build native addon from workspace root (requires Rust)
bun run build

# Type check
bun run check
```

## 建筑

```text
crates/pi-natives/       # Rust source (workspace member)
  src/lib.rs             # N-API exports
  src/image.rs           # SIXEL image decoding and encoding
  Cargo.toml             # Rust dependencies
native/                  # Native addon binaries
  pi_natives.<platform>-<arch>-modern.node   # x64 modern ISA (AVX2)
  pi_natives.<platform>-<arch>-baseline.node # x64 baseline ISA
  pi_natives.<platform>-<arch>.node          # non-x64 build artifact
src/                     # TypeScript wrappers
  native.ts              # Native addon loader
  index.ts               # Public API
```

## 常见问题

### @f5-sales-demo/pi-natives 是什么？

用于grep、剪贴板、图像处理、语法突出显示、PTY和通过N-API的 shell 操作的原生 Rust 绑定

### 如何安装 @f5-sales-demo/pi-natives？

在项目目录运行 npm install @f5-sales-demo/pi-natives，或使用 pnpm add / yarn add / bun add。

### @f5-sales-demo/pi-natives 支持 TypeScript 吗？

支持。包内自带 TypeScript 类型声明（package\.json 声明了 types 入口），安装后即可获得类型提示，无需再安装 @types 包。

### @f5-sales-demo/pi-natives 支持 ESM 还是 CommonJS？

同时提供 ES Module 与 CommonJS 入口，import 和 require\(\) 都可以使用，打包工具会自动选择合适的版本。

### @f5-sales-demo/pi-natives 可以商用吗？

@f5-sales-demo/pi-natives 使用 MIT 许可。宽松许可：允许商业使用、修改和再分发，通常只需在分发时保留原版权与许可声明。以上为概括，不构成法律意见，请以许可原文为准。

### @f5-sales-demo/pi-natives 的下载量有多少？

根据 npm 官方下载统计，@f5-sales-demo/pi-natives 在 2026/10/14 – 2026/11/12 这 30 天内被下载 8,991 次，日均约 300 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入，适合横向比较热度，不能直接等同于使用人数。

### @f5-sales-demo/pi-natives 还在维护吗？

最新版本 23\.10\.13 发布于 2026/11/13（1 天前）；至今共发布 450 个版本，其中过去 12 个月发布了 450 个；首次发布于 2026/06/26。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

