Appearance
informat.website 网站资源托管 
概述 
使用informat.website对象进行资源和组件设计器模块相关操作。网站资源的存储类似于文件系统的目录结构。
WebsiteResource的结构 
ts
{
    name:String;//资源文件名
    path:String;//资源的完整路径,
    isDirectory:Boolean;//是否是目录
}list 
根据父目录获取网站的资源列表
javascript
informat.website.list(moduleId, path, recursion)| 参数 | 类型 | 描述 | 
|---|---|---|
| moduleId | String | 网站模块的标识符 | 
| path | String | 资源路径,如果path为null,则返回根目录下的资源 | 
| recursion | Boolean | 是否递归的返回所有下级,如果recursion为false,只会返回第一级子目录 | 
返回值 类型为 Array<WebsiteResource> 返回资源列表
示例-获取网站资源托管模块的所有资源列表
js
informat.website.list('scriptResource',null,true);json
[
  {
    "directory": true,
    "isDirectory": true,
    "name": "mpp",
    "path": "mpp"
  },
  {
    "directory": false,
    "isDirectory": false,
    "name": "软件开发.mpp",
    "path": "mpp/软件开发.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 
通过路径获取资源
javascript
informat.website.getByPath(moduleId, path)| 参数 | 类型 | 描述 | 
|---|---|---|
| moduleId | String | 网站模块的标识符 | 
| path | String | 资源路径 | 
返回值 类型为 WebsiteResource 返回资源
示例
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 
将资源下载到本地文件共享存储
javascript
informat.website.download(moduleId, path, localPath)| 参数 | 类型 | 描述 | 
|---|---|---|
| moduleId | String | 网站模块的标识符 | 
| path | String | 资源路径 | 
| localPath | String | 本地存储沙盒中的路径 | 
示例
javascript
// 下载指定网站模块word/logo.png资源到本地文件localPath路径
informat.website.download('scriptResource', 'word/logo.png', 'local/logo.png');getStroagePath 
通过网站资源路径查询它的共享存储路径
javascript
informat.website.getStroagePath(moduleId, path)| 参数 | 类型 | 描述 | 
|---|---|---|
| moduleId | String | 网站模块的标识符 | 
| path | String | 资源路径 | 
示例
js
informat.website.getStroagePath('scriptResource','word/logo.png');json
"icxt9rsd1f0ai/demoApp/oryesvrjpy6rp/238aa17dbf054a11a7573f8d80d27c08.png"返回值解读
- icxt9rsd1f0ai:团队ID
- demoApp:应用标识符
- oryesvrjpy6rp:网址资源托管模块ID
- 238aa17dbf054a11a7573f8d80d27c08.png:资源文件ID

