Home > SYS_FileSystem > saveFileToFileSystem
SYS_FileSystem.saveFileToFileSystem() method
This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Write a file to the file system
Signature
function saveFileToFileSystem(
uri: string,
fileData: File | Blob,
fileName?: string,
): Promise<boolean>;2
3
4
5
Parameters
Parameter | Type | Description |
|---|---|---|
uri | string | File resource locator. If it ends with a slash |
fileData | File | Blob | File data |
fileName | string | (Optional) File name |
Returns
Promise<boolean>
Whether the write operation was successful. If overwriting is not allowed but the file already exists, false is returned
Remarks
Note 1: This API is only valid for clients. Calling it in a browser environment will always throw Error
Note 2: This API requires the user to enable the extension external interaction permission, if not enabled, it will always throw Error
注意 3:CLI 本地文件写入**不做路径白名单校验**、不受 APP_PROJECT_DIR 限制;uri 结尾带斜杠 /(Windows 为反斜杠 \)识别为目录,force 控制是否覆盖已存在文件