getFilesListByFolder()

Syntax

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, path parameter will be created by joining the folder's name, and each name is separated by a slash “/” character.

Parameters

NameTypeRequiredDescription

projectId

string

Yes

The project ID.

path

string

Yes

The folder path is created by folders name, each name is separated by a "/".

token

string

No

The authentication token response from Eueno API when login. After login, this token was saved in local storage with the name “eueno-token".

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.

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

Response of example:

{
    "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
    }
}

Last updated