Path.writeText
void writeText(string content, string encoding = "utf-8", string errors = "strict",
string newline = null, bool atomic = false) constWrites text to the file (overwrites) with configurable encoding, newline handling, and optional atomic replace. Modeled after Python's pathlib.Path.write_text.
Parameters
content | The text content to write. |
encoding | The name of the text encoding to encode with. Supported: "utf-8" (aliases: "utf8"). |
errors | Error handling on encode. For UTF-8 this is mostly irrelevant; kept for API parity. Accepted values: "strict" (default), "replace", "ignore". |
newline | Controls newline translation before writing: - null (default): translate "\n" to platform default ("\r\n" on Windows, "\n" elsewhere). - "": no translation; write content as-is. - one of "\n", "\r\n", "\r": translate "\n" to the given style. |
atomic | If true, perform an atomic write by writing to a temporary file in the same directory and renaming over the target. |