---
name: "queryAlbumFileIndexs"
mode: "kit"
versionRequirements:
  - { name: "P2PKit", version: "1.0.0" }
  - { name: "@ray-js/ray", version: "1.3.15" }
platform:
  - "iOS"
  - "Android"
async: true
title: "p2p.queryAlbumFileIndexs - Query the device album file index list"
---

## queryAlbumFileIndexs

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

> [PLATFORM] iOS, Android

> ⚡ **Supports Promise** — Returns a Promise when success / fail / complete callbacks are omitted.

### Description

Query the device’s album file index information

### Parameters

| Property | Type | Required | Default | Since | Description |
| --- | --- | --- | --- | --- | --- |
| `deviceId` | `string` | Yes | - | `1.0.0` | Device ID |
| `albumName` | `string` | Yes | - | `1.0.0` | albumName, provided by the device |
| `complete` | `() => void` | No | - | - | Completion callback (executed on both success and failure) |
| `success` | `(params: Object) => void` ↓see below | No | - | - | Callback on successful API call |
| `fail` | `(params: Object) => void` ↓see below | No | - | - | Failure callback |

#### success callback parameters

| Property | Type | Since | Description |
| --- | --- | --- | --- |
| `count` | `number` | `2.0.2` | File count |
| `items` | `ThingP2PAlbumFileIndex[]` | `2.0.2` | File index information |

#### fail callback parameters

| Property | Type | Description |
| --- | --- | --- |
| `errorMsg` | `string` | Error message |
| `errorCode` | `string \| number` | Error code |
| `innerError` | `Object` | Error extension |

##### fail(params).innerError properties

| Property | Type | Description |
| --- | --- | --- |
| `errorCode` | `string \| number` | Error extension code |
| `errorMsg` | `string` | Error extension message |


### Referenced Types

##### `interface` ThingP2PAlbumFileIndex

| Property | Type | Since | Description |
| --- | --- | --- | --- |
| `idx` | `number` | `2.0.2` | idx,given by the device |
| `channel` | `number` | `2.0.2` | channel channel number |
| `type` | `number` | `2.0.2` | type file type,0: image，2: mp4, 3: Panoramic stitching file |
| `dir` | `number` | `2.0.2` | dir 0: file，1: directory |
| `filename` | `string` | `2.0.2` | file name contains suffix |
| `createTime` | `number` | `2.0.2` | createTime file create time |
| `duration` | `number` | `2.0.2` | duration file duration |


### Examples

#### Demo

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

p2p.queryAlbumFileIndexs({
  deviceId: "xx",
  albumName: "xx",
  success: data => {
    console.log(data);
  },
  fail: error => {
    console.error(error);
  },
});
```
