---
name: "onFileDownloadComplete"
mode: "kit"
versionRequirements:
  - { name: "P2PKit", version: "1.0.0" }
  - { name: "@ray-js/ray", version: "1.3.15" }
platform:
  - "iOS"
  - "Android"
async: true
title: "p2p.onFileDownloadComplete - 单文件下载完成事件"
---

## onFileDownloadComplete

> [VERSION] P2PKit >= 1.0.0 | @ray-js/ray >= 1.3.15

> [PLATFORM] iOS, Android

> ⚡ **支持 Promise 调用** — 不传 success / fail / complete 回调时，该方法返回 Promise。

### 描述

single file download completed event

### 参数

`(listener: Function)`

| 参数 | 类型 | 必填 | 默认值 | 描述 |
| --- | --- | --- | --- | --- |
| `listener` | `(params: FileDownloadCompletionEvent) => void` | 是 | - |  |

### 引用对象

##### `interface` FileDownloadCompletionEvent

| 属性 | 类型 | 最低版本 | 描述 |
| --- | --- | --- | --- |
| `deviceId` | `string` | `1.0.0` | device id |
| `fileName` | `string` | `1.0.0` | file name |
| `index` | `number` | `1.0.0` | index |


### 示例代码

#### Demo

```tsx
import { p2p } from '@ray-js/ray'

p2p.onFileDownloadComplete(e => {
  console.log(e);
});
```
