Write file
- 18 May 2022
- 1 Minute to read
- DarkLight
- PDF
Write file
- Updated on 18 May 2022
- 1 Minute to read
- DarkLight
- PDF
Article Summary
Writes data to a target file. You can set the encoding and whether or not the data should be appended to the end, or the whole file overwritten.
Input arguments
Label | Key | Type | Required? | Default | Description |
---|---|---|---|---|---|
Target file path | path | String(local-filesystem-reference) | Yes | – | Absolute local filesystem path to the target file. |
Data to write | data | String | Yes | – | Data to write into the target file. |
File encoding | encoding | String | Yes | utf8 | Encoding with which to write into the target file. |
Overwrite file? | overwrite | Boolean | Yes | true | If true , overwrite the target file. If false , data is appended to the end of the target file. |
Output arguments
Number of outputs: 2
Label | Key | Type | Description |
---|---|---|---|
File | file | Object | Object representing the written file. |
| file.path | String | Absolute local filesystem path representing the file location on the device, including the filename and extension. On web, this is created via the [`createObjectURL`](https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL) method. |
| file.mimeType | String | MIME type of the file, if it could be determined. |
| file.name | String | Name of the file in the local filesystem, if applicable. Note that the filename and extension are included in the **Local path** property already. |
| file.size | Number | Size of the file, in bytes. |
| file.createdAt | String | Creation datetime of the file, if it can be determined. |
| file.modifiedAt | String | Datetime when the file was last modified, if it can be determined. |
Events
No events.
Errors
Label | Code | Description |
---|---|---|
Unkown error | unknown | Thrown if an unknown error occured while writing the file. |
Was this article helpful?