# getFilesListByFolder()

## Syntax

```javascript
getFilesListByFolder: (projectId: string, path: string, token?: string)
```

In case the method is used to get project detail, `path` = `projectId`. On the other hand, if the method is used to [get folder detail](https://app.gitbook.com/o/-MWcR8FSKZBU6KvaxcLP/s/QRsOb8nybzYU151xljhX/~/changes/31/eueno-libraries/eueno-lib-browser/get-folder-detail), `path` parameter will be created by joining the folder's name, and each name is separated by a slash “/” character.

## Parameters

<table><thead><tr><th width="116">Name</th><th width="121">Type</th><th width="108">Required</th><th>Description</th></tr></thead><tbody><tr><td>projectId</td><td>string</td><td>Yes</td><td>The project ID.</td></tr><tr><td>path</td><td>string</td><td>Yes</td><td>The folder path is created by folders name, each name is separated by a "/".</td></tr><tr><td>token</td><td>string</td><td>No</td><td>The authentication token response from Eueno API when login. After login, this token was saved in local storage with the name “eueno-token".</td></tr></tbody></table>

## Returns

Promise returns an object with two properties is:

* “folders” - \[ ]: array of folders name
* “files” - \[ ]: array of objects, each object includes file information

## Example

The example below shows how to get a project detail.

```javascript
import { getFilesListByFolder } from "@eueno/lib-browser";
const getProjectDetail = async () => {
   const projectId = “112”;
   const res = await getFilesListByFolder(projectId, projectId);
   console.log(res);
 };
```

Response of example:

```javascript
{
    "msg": "success",
    "data": {
        "folders": [
            "Folder1",
            "Folder2"
        ],
        "files": [
            {
                "id": "220125",
                "name": "init.json",
                "nameNo": 1,
                "url": "https://data.eueno.io/0x…",
                "backupUrl": "https://backup.eueno.io/0x…",
                "size": "42",
                "mimeType": "application/json",
                "method": "UN_ENCRYPT",
                "torrentSize": 0,
                "torrentUrl": null,
                "backupTorrentUrl": null,
                "encryptKey": null,
                "createdAt": "2023-03-09T02:58:22.000Z",
                "updatedAt": "2023-03-09T02:58:22.000Z"
            }
        ]
    },
    "options": {
        "totalItem": 3
    }
}
```
