writeFile(file_path, data, [mode], [overwrite], [create_dir])
Class: SwingUI.
Description:
Writes data to a file synchronously.
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
|
|
string | URL |
Local destination file path. |
|
|
|
string | ArrayBuffer | Uint8Array | Buffer |
Data to write to a file. |
|
|
|
string |
"write" |
"write" or "append" |
|
|
boolean |
true |
|
|
|
boolean |
false |
|
Returns:
Returns true on success, or throws an Error on failure.
Type: boolean
Throws:
- Error: When the file path is invalid.
- Error: When the file exists and
overwrite argument is not true.- Error: When access to the file is denied.
- Error: When directory to the specified file failed to be automatically created.
- Error: When the directory of the file path doesn't exist and
create_dir argument is not true.- Error: When failed to write the file.
