summaryrefslogtreecommitdiff
path: root/kvmd/aiotools.py
diff options
context:
space:
mode:
authorMaxim Devaev <[email protected]>2024-07-08 03:41:29 +0300
committerMaxim Devaev <[email protected]>2024-12-17 18:20:04 +0200
commit630610bc532299f15ff7ee12d40f617de450aae0 (patch)
treeca0a83f1aa5848a4605034c0394f1edfd0bea7ce /kvmd/aiotools.py
parente0bbf6968ef8295274793a564e717f95f42983d7 (diff)
switch
Diffstat (limited to 'kvmd/aiotools.py')
-rw-r--r--kvmd/aiotools.py5
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