Home > SYS_FileManager > getProjectFile
SYS_FileManager.getProjectFile() method
Get Project file
Signature
typescript
function getProjectFile(
fileName?: string,
password?: string,
fileType?: 'epro' | 'epro2',
): Promise<File | undefined>;1
2
3
4
5
2
3
4
5
Parameters
Parameter | Type | Description |
|---|---|---|
fileName | string | (Optional) File name |
password | string | (Optional) Encrypted password |
fileType | 'epro' | 'epro2' | (Optional) File format |
Returns
Promise<File | undefined>
Project file data, undefined indicates that it is currently not open project or data retrieval failed
Remarks
You can use SYS_FileSystem.saveFile() API export the file to the local file system
Note: This API requires the **Project Management > Download Project** permission. Calling it without permission will always throw Error
Example
javascript
// 1. 导出当前工程为文件(文件名自动带上 epro2 扩展名)
const projectFile = await eda.sys_FileManager.getProjectFile('嘉立创示例_工程导出');
// 2. 输出文件信息(size 单位为字节)
console.log('文件名:', projectFile.name);
console.log('文件大小:', projectFile.size);1
2
3
4
5
6
2
3
4
5
6