diff options
author | Maxim Devaev <[email protected]> | 2024-07-08 03:41:29 +0300 |
---|---|---|
committer | Maxim Devaev <[email protected]> | 2024-12-17 18:20:04 +0200 |
commit | 630610bc532299f15ff7ee12d40f617de450aae0 (patch) | |
tree | ca0a83f1aa5848a4605034c0394f1edfd0bea7ce /kvmd/aiotools.py | |
parent | e0bbf6968ef8295274793a564e717f95f42983d7 (diff) |
switch
Diffstat (limited to 'kvmd/aiotools.py')
-rw-r--r-- | kvmd/aiotools.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/kvmd/aiotools.py b/kvmd/aiotools.py index a47c94c6..6183690f 100644 --- a/kvmd/aiotools.py +++ b/kvmd/aiotools.py @@ -45,6 +45,11 @@ async def read_file(path: str) -> str: return (await file.read()) +async def write_file(path: str, text: str) -> None: + async with aiofiles.open(path, "w") as file: + await file.write(text) + + # ===== def run(coro: Coroutine, final: (Coroutine | None)=None) -> None: # https://github.com/aio-libs/aiohttp/blob/a1d4dac1d/aiohttp/web.py#L515 |