Home > SYS_FileManager > getCbbFileByCbbUuid
SYS_FileManager.getCbbFileByCbbUuid() method
此 API 当前处于 BETA 预览状态,希望得到开发者的反馈。它的任何功能都可能在接下来的开发进程中被修改,请不要将它用于任何正式环境。
使用复用模块 UUID 获取复用模块文件
签名
typescript
function getCbbFileByCbbUuid(
cbbUuid: string,
libraryUuid?: string,
props?: {
fileName?: undefined | string;
password?: undefined | string;
fileType?: undefined | 'epro' | 'epro2';
templateSchematicUuid?: undefined | string;
templatePcbUuid?: undefined | string;
},
): Promise<File | undefined>;1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
参数名
参数 | 类型 | 描述 |
|---|---|---|
cbbUuid | string | 复用模块 UUID |
libraryUuid | string | (可选) 库 UUID,可以使用 LIB_LibrariesList 内的接口获取,如若不传入,则为系统库 |
props | { fileName?: undefined | string; password?: undefined | string; fileType?: undefined | 'epro' | 'epro2'; templateSchematicUuid?: undefined | string; templatePcbUuid?: undefined | string } | (Optional) |
返回值
Promise<File | undefined>
复用模块文件数据,undefined 表示数据获取失败
备注
可以使用 SYS_FileSystem.saveFile() 接口将文件导出到本地文件系统
注意:本接口需要启用 **团队模块 > 下载模块** 权限,没有权限调用将始终 throw Error
示例
javascript
// 1. 列出系统库中的复用模块,取第一个的 UUID
const cbbList = await eda.lib_Cbb.search('', undefined, undefined, 5);
const cbb = cbbList[0];
// 2. 按复用模块 UUID 获取文件,props.fileName 指定导出文件名
const cbbFile = await eda.sys_FileManager.getCbbFileByCbbUuid(cbb.uuid, undefined, {
fileName: '嘉立创示例_复用模块',
});
// 3. 输出复用模块与文件信息(size 单位为字节)
console.log('复用模块名:', cbb.name);
console.log('文件名:', cbbFile.name);
console.log('文件大小:', cbbFile.size);1
2
3
4
5
6
7
8
9
10
11
12
13
2
3
4
5
6
7
8
9
10
11
12
13