informat.website Website Resource Hosting
Overview
Use the informat.website object to perform operations related to resources and component-designer modules. Website resources are stored in a directory structure similar to a file system.
WebsiteResource Structure
ts
{
name: String; //Resource file name
path: String; //Full path of the resource,
isDirectory: Boolean; //Whether it is a directory
}list
Get the website resource list based on the parent directory
javascript
informat.website.list(moduleId, path, recursion);| Parameter | Type | Description |
|---|---|---|
| moduleId | String | The identifier of the website module. |
| path | String | The resource path. If path is null, return resources in the root directory. |
| recursion | Boolean | Whether to return all subdirectories recursively. If recursion is false, only the first-level subdirectories are returned. |
Return Value Type is Array<WebsiteResource> Returns the resource list
Example - Get All Resource Lists of the Website Resource Hosting Module
js
informat.website.list('scriptResource',null,true);json
[
{
"directory": true,
"isDirectory": true,
"name": "mpp",
"path": "mpp"
},
{
"directory": false,
"isDirectory": false,
"name": "Software Development.mpp",
"path": "mpp/Software Development.mpp"
},
{
"directory": true,
"isDirectory": true,
"name": "excel",
"path": "excel"
},
{
"directory": false,
"isDirectory": false,
"name": "excelFileToDataList.xlsx",
"path": "excel/excelFileToDataList.xlsx"
},
{
"directory": true,
"isDirectory": true,
"name": "word",
"path": "word"
},
{
"directory": false,
"isDirectory": false,
"name": "template.docx",
"path": "word/template.docx"
},
{
"directory": false,
"isDirectory": false,
"name": "logo.png",
"path": "word/logo.png"
}
]getByPath
Get resource by path
javascript
informat.website.getByPath(moduleId, path);| Parameter | Type | Description |
|---|---|---|
| moduleId | String | The identifier of the website module. |
| path | String | The resource path. |
Return Value Type is WebsiteResource Returns the resource
Example
js
informat.website.getByPath('scriptResource','word/logo.png');;json
{
"directory": false,
"fileId": "238aa17dbf054a11a7573f8d80d27c08.png",
"id": "jy64cjyec9lnq",
"isDirectory": false,
"name": "logo.png",
"path": "word/logo.png"
}download
Download the resource to local file shared storage
javascript
informat.website.download(moduleId, path, localPath);| Parameter | Type | Description |
|---|---|---|
| moduleId | String | The identifier of the website module. |
| path | String | The resource path. |
| localPath | String | The path in the local file sandbox. |
Example
javascript
// Download the specified website module word/logo.png resource to the local file localPath
informat.website.download("scriptResource", "word/logo.png", "local/logo.png");getStroagePath
Query its shared storage path through the website resource path
javascript
informat.website.getStroagePath(moduleId, path);| Parameter | Type | Description |
|---|---|---|
| moduleId | String | The identifier of the website module. |
| path | String | The resource path. |
Example
js
informat.website.getStroagePath('scriptResource','word/logo.png');json
"icxt9rsd1f0ai/demoApp/oryesvrjpy6rp/238aa17dbf054a11a7573f8d80d27c08.png"Return Value Interpretation
- icxt9rsd1f0ai: Team ID
- demoApp: Application identifier
- oryesvrjpy6rp: Website resource hosting module ID
- 238aa17dbf054a11a7573f8d80d27c08.png: Resource file ID

