Home > SYS_FileManager > getDeviceFileByDeviceUuid
SYS_FileManager.getDeviceFileByDeviceUuid() method
Use device UUID get device file
Signature
typescript
function getDeviceFileByDeviceUuid(
deviceUuid: string | Array<string>,
libraryUuid?: string,
fileType?: 'elibz' | 'elibz2',
): Promise<File | undefined>;1
2
3
4
5
2
3
4
5
Parameters
Parameter | Type | Description |
|---|---|---|
deviceUuid | string | Array<string> | Device UUID or device UUID list |
libraryUuid | string | (Optional) Library UUID. It can be obtained using the APIs in LIB_LibrariesList. If not passed in, it is the system library |
fileType | 'elibz' | 'elibz2' | (Optional) |
Returns
Promise<File | undefined>
Device file data, undefined indicates that the data retrieval failed
Remarks
You can use SYS_FileSystem.saveFile() API export the file to the local file system
Note: This API requires the **Team Library > Download Library** permission. Calling it without permission will always throw Error
Example
javascript
// 1. 按立创编号精确搜索系统库器件,取第一个的 UUID
const deviceList = await eda.lib_Device.searchByProperties({ supplierId: 'C1523' }, undefined, undefined, undefined, 5, 1);
const device = deviceList[0];
// 2. 按器件 UUID 获取器件文件
const deviceFile = await eda.sys_FileManager.getDeviceFileByDeviceUuid(device.uuid);
// 3. 输出器件与文件信息(size 单位为字节)
console.log('器件名:', device.name);
console.log('文件名:', deviceFile.name);
console.log('文件大小:', deviceFile.size);1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11