This topic describes how to use the info interface to query files.
The SDK version must be 3.1.3 or later.
Method definition
mpserverless.file.info(fileId: String | String[]): Promise<Result[]>Request parameters
Interface parameters:
Field name | Type | Required | Description |
| String or String[] | Yes | The file ID. You can pass an array to query multiple files. Note
|
Return parameters
The returned parameter is an array:
Field | Type | Description |
| String | The file ID. |
| Int | The time the file was uploaded, in seconds. |
| Int | The time the file was last modified, in seconds. |
| String | The original name of the file. |
| Int | The file size, in bytes. |
| String | The file type. |
| String | The CDN-accelerated URL for accessing and downloading the file. |
Examples
Sample query file:
const image = await mpserverless.file.info("5d916ee7-869f-4b90-8224-2ad15e25****");
console.log(image);Sample output:
[
{
"fileId": "5d916ee7-869f-4b90-8224-2ad15e25****",
"gmtCreate": 1665220833,
"gmtModified": 1665220833,
"name": "hello.png",
"size": 29661,
"type": "png",
"url": "https://mp-c68e6766-2bda-4263-****-29696919923f.cdn.bspapp.com/cloudstorage/4abe575f-19c8-4b9b-b1cc-4fa385d7****.png"
}
]