# @fingerprint/agent 中文文档

规范地址：https://npmcn.com/package/%40fingerprint/agent/

版本：4\.1\.6
npm 元数据更新时间：2026-10-07T13:05:25.350Z
中文译文更新时间：2026-11-14T18:47:15.107Z
软件包许可：SEE LICENSE IN LICENSE

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

原始 npm 页面：https://www.npmjs.com/package/%40fingerprint/agent
原文对照：https://npmcn.com/package/%40fingerprint/agent/?lang=original
项目主页：https://fingerprint.com/

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

- 包体积（解压后）：49.2 kB，6 个文件
- 模块格式：ESM + CJS
- TypeScript 类型：包内自带
- 运行依赖：0 个
- 首次发布：2025-11-05T17:58:53.920Z
- 最新版本发布：2026-10-07T13:05:24.711Z
- 近 30 天下载量：958912（2026-10-15 至 2026-11-13，npm 官方下载统计）
- 已发布版本数：14（近 12 个月 13 个）

## 中文简介

指纹 JavaScript 代理

## 安装

```sh
npm install @fingerprint/agent
```

也可以使用：`pnpm add @fingerprint/agent`、`yarn add @fingerprint/agent`、`bun add @fingerprint/agent`

## README

  
[![Fingerprint logo](https://fingerprintjs.github.io/home/resources/logo_dark.svg)](https://fingerprint.com/)

制作浏览器指纹的网站访问者标识符 . 与饼干和本地存储不同,指纹在隐形/私人模式中保持不变,甚至在浏览器数据被清洗时也是如此. 提供与开源指纹JS相比的额外信息和更高的准确性.

## 快开始

获取亲密钥 :

1.  在 [仪表板.指印.com/签名](https://dashboard.fingerprint.com/signup) (有免费的审判)
2.  注册后去 [仪表板](https://dashboard.fingerprint.com/) 并选择创建的订阅
3.  访问页面左侧导航侧栏中的“ API 键” 页面
4.  用“ 公用” 类型复制密钥

### 从国家预防机制安装

```bash
npm i @fingerprint/agent
# or
yarn add @fingerprint/agent
# or
pnpm add @fingerprint/agent
# or
bun add @fingerprint/agent
```

```js
import Fingerprint from '@fingerprint/agent'

// Initialize an agent at application startup.
const fpPromise = Fingerprint.start({ apiKey: 'your-pro-key' })

;(async () => {
  // Get the visitor identifier when you need it.
  const fp = await fpPromise
  const result = await fp.get()

  // This is the visitor identifier:
  const visitorId = result.visitorId
  console.log(visitorId)
})()
```

[运行此代码](https://stackblitz.com/edit/fpjs-pro-3-npm?file=index.js&devtoolsheight=100)

### 或者从 CDN 安装

```html
<script>
  // Initialize the agent at application startup.
  const fpPromise = import('https://fpjscdn.net/v4/your-pro-key')
    .then(FingerprintJS => FingerprintJS.start())

  // Get the visitor identifier when you need it.
  fpPromise
    .then(fp => fp.get())
    .then(result => {
      // This is the visitor identifier:
      const visitorId = result.visitorId
      console.log(visitorId)
    })
</script>
```

注意您需要替换 `your-pro-key` 带有 API 公共密钥 [仪表板](https://dashboard.fingerprint.com/)。 。 。 .

[运行此代码](https://stackblitz.com/edit/fpjs-pro-3-cdn?file=index.html&devtoolsheight=100)

## 另见

🍿 [现场演示](https://fingerprint.com/demo)

⏱ [30秒内如何从开源升级到Pro](https://docs.fingerprint.com/docs/migrating-from-fingerprintjs-to-fingerprint-pro)

⬆️ [如何从指纹版本 3 迁移](https://docs.fingerprint.com/reference/migrating-from-v3-to-v4)

📕 [指纹文件](https://dev.fingerprint.com/)

▶️ [视频:使用指纹防止多次签名](https://www.youtube.com/watch?v=jWX9P5_jZn8)

## 常见问题

### @fingerprint/agent 是什么？

指纹 JavaScript 代理

### 如何安装 @fingerprint/agent？

在项目目录运行 npm install @fingerprint/agent，或使用 pnpm add / yarn add / bun add。

### @fingerprint/agent 支持 TypeScript 吗？

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

### @fingerprint/agent 支持 ESM 还是 CommonJS？

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

### @fingerprint/agent 可以商用吗？

@fingerprint/agent 使用 SEE LICENSE IN LICENSE 许可。许可条款写在包内的独立文件中，请阅读该文件确认可否商用。以上为概括，不构成法律意见，请以许可原文为准。

### @fingerprint/agent 的下载量有多少？

根据 npm 官方下载统计，@fingerprint/agent 在 2026/10/15 – 2026/11/13 这 30 天内被下载 958,912 次，日均约 31,964 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入，适合横向比较热度，不能直接等同于使用人数。

### @fingerprint/agent 还在维护吗？

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

