Argument | Description | Types / Required |
path | The path of the file to write. | string
required |
text | The text to write. | string
required |
encoding | The encoding to use while writing the text.
The default value is "UTF-8". | string
not required |
The
File.writeText action writes a string,
text, to a text file specified as
path. If a file already exists at
path, it is overwritten with the new contents.
The
encoding argument allows you specify how the contents of the file are
encoded to text. Options include:
- "ANSI": The contents are encoded as part of the Windows code page.
- "UTF-8": The contents are encoded as UTF-8 and written without a byte order mark (BOM).
- "UTF-8-BOM": The contents are encoded as UTF-8 and written with a three-byte BOM.
The action returns undefined.
The action throws an exception if any of its arguments are not specified in a valid form or if the file cannot be created or fully written.