Classes | |
| class | WriteError |
Functions | |
| None | write_utf8_file (str filename, bytes|str utf8_data, bool private=False, str mode="w") |
| None | write_utf8_file_atomic (str filename, bytes|str utf8_data, bool private=False, str mode="w") |
Variables | |
| _LOGGER = logging.getLogger(__name__) | |
File utility functions.
| None homeassistant.util.file.write_utf8_file | ( | str | filename, |
| bytes | str | utf8_data, | ||
| bool | private = False, |
||
| str | mode = "w" |
||
| ) |
| None homeassistant.util.file.write_utf8_file_atomic | ( | str | filename, |
| bytes | str | utf8_data, | ||
| bool | private = False, |
||
| str | mode = "w" |
||
| ) |
Write a file and rename it into place using atomicwrites. Writes all or nothing. This function uses fsync under the hood. It should only be used to write mission critical files as fsync can block for a few seconds or longer is the disk is busy. Using this function frequently will significantly negatively impact performance.